2012/7/17 billb <b...@briskynet.com> > Thanks for the ideas! > > A quick question about subclassing Preference. The only place I use > Preference directly is in XML to define the button. If I create a subclass > of Preference can I then use that new class name in the XML directly in > place of the <Preference> tag (e.g. <MyButtonPreference>)? >
Yes you can, except it'll need to be something like: <com.briskynet.bill.appname.GoHomePreference android:title="..." android:summary="...." /> ... etc. Basically, same thing you'd do with a view subclass - using a fully qualified class name as the tag. -- K > > If not, where do I instantiate the MyButtonPreference subclass? > > I'm still getting comfortable with the whole Android paradigm, so I > apologize if this is something that seems straight-forward. > > As they say, everything is easy once you know how. > > B. > On Tuesday, July 17, 2012 10:47:56 AM UTC-7, Kostya Vasilyev wrote: > >> >> The findPreference method is deprecated. >>> >> >> Yes, but the old Preference mechamism still works, at least in 4.1. >> >> You actually don't need to use findPreference -- >> >> Rather, create a Preference subclass, override onClick, and launch the >> main activity with an intent that includes Intent.FLAG_ACTIVITY_CLEAR_TOP >> >> ( or call the preference activity's finish, if your stack only has the >> main activity and the preference activity at this time ). >> >> -- K >> >> >> >>> >>> I'm not sure if this is part of the whole move to preference fragments >>> or not. >>> >>> I'll keep searching, and if anyone else has other ideas that would be >>> much appreciated. >>> >>> B. >>> >>> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en