Re: [android-developers] Re: How do you create a custom Preference which needs to invoke a activity for result like RingtonePreference?

2010-08-13 Thread Kostya Vasilyev

 Pino,

You can always implement your own subclass of Preference.

The same thing can be done differently inside Android and in regular 
applications, that's Ok.


Subclassing Preference is actually quite nice, since the base class 
handles the drawing of title and subtitle strings, so your own 
preference will automatically have the right look.


Override onClick() and do whatever it is you want to do.

-- Kostya

13.08.2010 8:19, Pino Silvaggio пишет:

Yes PreferenceActivity is an Activity.

But that not my problem.

The issue is how do I create a custom preference like
RingtonePreference
if what I need is in PreferenceManager and is hidden by package level?

example:

registerOnActivityResultListener

which is needed if I want to call
preferenceManager.getActivity().startActivityForResult()

which getActivity() is also hidden.

This makes no sense.

On Aug 12, 11:13 pm, TreKingtreking...@gmail.com  wrote:

On Thu, Aug 12, 2010 at 4:19 PM, Pino Silvaggiopino.silvag...@gmail.comwrote:


How should I proceed?

Hint: PreferenceActivity is an Activity like any other ...

-
TreKinghttp://sites.google.com/site/rezmobileapps/treking  - Chicago
transit tracking app for Android-powered devices



--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

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


Re: [android-developers] Re: How do you create a custom Preference which needs to invoke a activity for result like RingtonePreference?

2010-08-13 Thread TreKing
On Thu, Aug 12, 2010 at 11:19 PM, Pino Silvaggio
pino.silvag...@gmail.comwrote:

 Yes PreferenceActivity is an Activity.

 But that not my problem.


No, it's your solution.

From PreferenceActivity you can get the list of all preferences defined in
your Preferences, set click listeners for any of them, and call
startActivityForResult() from the PreferenceActivity to do whatever you
need. What's the problem with this?


 The issue is how do I create a custom preference like RingtonePreference


Extend Preference, just like it does?


 if what I need is in PreferenceManager and is hidden by package level?


I don't see what you *need* this.


 example:

 registerOnActivityResultListener

 which is needed if I want to call
 preferenceManager.getActivity().startActivityForResult()

 which getActivity() is also hidden.

 This makes no sense.


What makes no sense is why you feel you need to go through the
PreferenceManager functions when these two facilities are available to you
in PreferenceActivity.

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

[android-developers] Re: How do you create a custom Preference which needs to invoke a activity for result like RingtonePreference?

2010-08-13 Thread Pino Silvaggio
This is so simple.

If I use a PreferenceActivity to handle my CustomPreference onclick()
or any other state
of a Preference added to it then the CustomPreference is worthless and
is tied to a specific activity.

It's like RingtonePreference basically doesn't do anything and you
have to explicitly write code
in PreferenceActivity to make it work.

Just look at the android sources you'll understand what I mean.
RingtonePreference handles the
activity call to pick a ringtone and save it's state.

I want to create a CustomPreference that is self-contained like any
other android preferences.


On Aug 13, 10:39 am, TreKing treking...@gmail.com wrote:
 On Thu, Aug 12, 2010 at 11:19 PM, Pino Silvaggio
 pino.silvag...@gmail.comwrote:

  Yes PreferenceActivity is an Activity.

  But that not my problem.

 No, it's your solution.

 From PreferenceActivity you can get the list of all preferences defined in
 your Preferences, set click listeners for any of them, and call
 startActivityForResult() from the PreferenceActivity to do whatever you
 need. What's the problem with this?

  The issue is how do I create a custom preference like RingtonePreference

 Extend Preference, just like it does?

  if what I need is in PreferenceManager and is hidden by package level?

 I don't see what you *need* this.

  example:

  registerOnActivityResultListener

  which is needed if I want to call
  preferenceManager.getActivity().startActivityForResult()

  which getActivity() is also hidden.

  This makes no sense.

 What makes no sense is why you feel you need to go through the
 PreferenceManager functions when these two facilities are available to you
 in PreferenceActivity.

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


Re: [android-developers] Re: How do you create a custom Preference which needs to invoke a activity for result like RingtonePreference?

2010-08-13 Thread TreKing
On Fri, Aug 13, 2010 at 10:37 AM, Pino Silvaggio
pino.silvag...@gmail.comwrote:

 I want to create a CustomPreference that is self-contained like any other
 android preferences.


Ah, well, this makes it clear now what you're trying to do - this was not
clear to me before, sorry.

Maybe have your CustomPreference store a reference to Activity which you set
in the PreferenceActivity onCreate?
Not completely self-contained, but you need access to the parent Activity
*somewhere*.

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

[android-developers] Re: How do you create a custom Preference which needs to invoke a activity for result like RingtonePreference?

2010-08-12 Thread Pino Silvaggio
Yes PreferenceActivity is an Activity.

But that not my problem.

The issue is how do I create a custom preference like
RingtonePreference
if what I need is in PreferenceManager and is hidden by package level?

example:

registerOnActivityResultListener

which is needed if I want to call
preferenceManager.getActivity().startActivityForResult()

which getActivity() is also hidden.

This makes no sense.

On Aug 12, 11:13 pm, TreKing treking...@gmail.com wrote:
 On Thu, Aug 12, 2010 at 4:19 PM, Pino Silvaggio 
 pino.silvag...@gmail.comwrote:

  How should I proceed?

 Hint: PreferenceActivity is an Activity like any other ...

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