开发者

Starting custom PreferenceActivity INSIDE another PreferenceActivity

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.

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>

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?


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;
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜