android - Adding menus to child preference screens -
i have menu comes preferenceactivity. in child preference screens, lose menu (doesn't pop up). how can make menu pop children too?
thanks.
example:
<preferencescreen xmlns:android="http://schemas.android.com/apk/res/android" android:persistent="true"> <preferencecategory android:title="some category" android:persistent="true" android:orderingfromxml="true"> <preferencescreen android:title="some child screen" android:summary="some child summary"> <preferencecategory ...
the first preference screen has menu, when click on child one, no menu. how can add menu?
i faced similar issue. here did overcome issue.
in preferenceactivity oncreate method,
final preferencescreen childpref = (preferencescreen) findpreference("childprefid"); childpref .setonpreferenceclicklistener(new onpreferenceclicklistener() { @override public boolean onpreferenceclick(preference preference) { intent intent = new intent(preferenceactivity.this, yoursettings.class); intent.setaction("showchildpref"); startactivity(intent); return true; } }); intent intent = getintent(); if(intent.getaction() != null && intent.getaction().equals("showchildpref")) { setpreferencescreen(childpref); /*set flags here based on intent kind of menu create in onpreparemenu.*/ } }
Comments
Post a Comment