This sounds like exactly what I need.
 
I've done some searching and have found the "finish()" method for 
PreferencesActivity, however, I am now at a loss on how to call this method 
from within the Preference subclass.
 
I have this so far:
 
public class GoHomePreference extends Preference
{
     public GoHomePreference (Context context)
     {
           super(context);
     }
 
     @Override
     public void onClick()
     {
          ??????????.finish();
     }
}
 
Once again I apologize for my lack of experience.
 
also, Thank you for your advice.
B.
 
On Tuesday, July 17, 2012 11:57:16 AM UTC-7, Kostya Vasilyev wrote:

>
> 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

Reply via email to