起自preferenceActivity内的另一个preferenceActivity [英] Starting custom PreferenceActivity INSIDE another PreferenceActivity
问题描述
在我的配置活动,我需要在显示的内容的preVIEW在页面中配置的顶部有一个固定视图创建preference屏幕。我不想改变主preference屏幕(我已经为一个独立的活动),我想一个嵌套preferencescreen不同的布局。
Inside my Configuration activity i need to create a preference screen with a fixed View at the top showing a preview of content configured in the page. I don't want to change the main preference screen (i have already a separate activity for that) i want a different layout for a "nested" preferencescreen.
我已经试过被指定preference屏幕内的意向然而,当我对这个选择没有任何反应和活动进入超时点击......活动是正确的配置清单(并延伸ConfigureActivity为主人做)。
What i've tried is specifying an Intent inside the preference screen however when i click on this options nothing happens and activity goes into timeout... Activity is correctly configured on the manifest (and extends ConfigureActivity as the main one does).
<PreferenceScreen
android:key="inner"
android:title="Title"
android:summary="Summary"
>
<intent
android:action="android.appwidget.action.APPWIDGET_CONFIGURE"
android:targetPackage="my.package.lib"
android:targetClass="my.package.lib.ConfigureClass"
/>
</PreferenceScreen>
另一个想法可以创建自定义preference即启动另外一个配置活动,可能这项工作?将是正确/接受有多个配置的活动?
Another idea could be creating a custom "preference" that launches another configuration activity, could this work? Would be correct/acceptable to have multiple configuration activities?
推荐答案
在主ConfigureActivity以下code工作,但是我不知道如果一个干净的方式做我想做的。可能有人证实?
The following code on the main ConfigureActivity works however i don't know if its a clean way to do what i want. Could someone confirm?
PreferenceScreen b = (PreferenceScreen) findPreference("my_empty_preference_screen");
b.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(ConfigureActivity.this, ConfigureActivity.class);
intent.setAction("android.appwidget.action.APPWIDGET_CONFIGURE");
ConfigureActivity.this.startActivity(intent);
return false;
}
});
这篇关于起自preferenceActivity内的另一个preferenceActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!