Bill,
Regarding the onClick not working... This made me go hmmmm so I put
together a simple test:
>>>
package org.kman.AquaMail.prefs;
import android.content.Context;
import android.preference.Preference;
import android.util.AttributeSet;
import android.widget.Toast;
public class TestOnClickPreference extends Preference {
public TestOnClickPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onClick() {
final Context context = getContext();
Toast.makeText(context, "I've been clicked!", Toast.LENGTH_SHORT).show();
}
}
<<<
and in the preference xml file:
>>>
<org.kman.AquaMail.prefs.TestOnClickPreference
android:summary="OnClick summary"
android:title="OnClick title" />
<<<
It definitely works, onClick gets called and the toast shows....
TreKing's way is a bit more simple though (I have more than a dozen various
preference subclasses in my current project, so naturally, was thinking
along those lines).
Regarding your comment on Android - there are 15 thousand developers on
this list last I checked, and many many more who are not.
So - "спасение утопающих - обязанность самих утопающих", for the most part
:)
-- K
2012/7/18 billb <[email protected]>
> Thanks for everything. A rather disappointing ending, but a very
> informative thread.
>
> I'll be taking your advice and seeing where it leads.
>
> I appreciate everything that both of you have added to my experience and
> knowledge.
>
> I am finding that the Android community is very knowledgeable and helpful,
> whereas the actual Android project seems a bit disjointed. Good product
> but poor communications with the community. At least it seems that way so
> far.
>
> Thanks again everyone!
>
> B.
>
>
> On Tuesday, July 17, 2012 8:45:25 PM UTC-7, TreKing wrote:
>
>>
>> I have overridden the Preference class onClick method with the below,
>>> however, I set a breakpoint that is never reached.
>>
>>
>> Can't help you there as I've never extended Preference and tried what
>> you're doing. I'll reiterate that you can just use findPreference. Even if
>> it is deprecated, it's not going away any time soon and you'll achieve what
>> you're after in 1 line of code and about 30 seconds.
>>
>> findPreference("pref").**setIntent(new Intent(...));
>>
>> Done.
>>
>> Later, when you have time, you can refactor it to do it "correctly" using
>> the fancy new Fragments stuff.
>>
>> Deriving a custom Preference class for the explicit purpose of handling
>> one very specific action on clicking it is kinda overkill, IMO.
>>
>> ------------------------------**------------------------------**
>> ------------------------------**-------
>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>> transit tracking app for Android-powered devices
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en