Thanks for your advice, but let me explain my problem a bit further:

We're localizing Android, and have added a calendar option (to select
one beside the default Gregorian calendar) to the system preferences.
We want it to affect all the applications (Messaging, Call log, ...),
without changing the applications themselves. We've added a class to
be called by android.text.format.Time, but since Time doesn't have
context, our class can't get the current choice of calendar.

The worst option I guess is to add alternative methods to Time,
DateUtils, ... to get and pass Context to our class. It needs changing
and adding lots of methods, classes, and even applications. The best
option is to get the calendar preference in Time or in our own class.

What's your suggestion?

Mostafa

On Tue, Dec 1, 2009 at 12:37 AM, Dianne Hackborn <hack...@android.com> wrote:
> Sorry you can't.  Most everything goes through Context; you'll need to pass
> a Context in to your utility methods.
>
> On Mon, Nov 30, 2009 at 8:29 AM, Mostafa <mostaf...@gmail.com> wrote:
>>
>> Hi,
>>
>> I want to get a system preference value in a class, but I don't have
>> the context there, because the class that calls it doesn't have the
>> context either. I've found that for Resources one can use the static
>> Resources.getSystem() function. Is there any similar way for getting
>> system preferences without context?
>>
>> My class isn't an activity nor service. It's a utility class. Could
>> give more info if needed.
>>
>> --
>> 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
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
> --
> 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