Jonathan S wrote:

> That wouldn't work because getResources need Context. 
>

I gave an example to use inside an Activity.

So the Context instance is 'this'.

So yes, it should work.
 

> You have to call it in a function like public static boolean 
> isGoogleMarket(Context context) { 
> context.getResources().getBoolean(R.bool.forMarket)
>
> We're already inside an Activity in my scenario, so that isn't necessary.

Admittedly I should have been explicit about my assumption that the call is 
from within an Activity instance.

My first suggestion of a static variable was crap.
 

> R.bool.forMarket is a constants too. 
>

Sorry?

Lew wrote:
>
>> You probably should go for a resource-based approach.
>>
>>   private static final boolean FOR_GOOGLE_MARKET = R.bool.forMarket;
>>
>> etc.
>>
>> Sorry, this is crap. I should have said:
>
>    private final boolean FOR_GOOGLE_MARKET = 
> getResources().getBoolean(R.bool.forMarket);
>
> or similar.
>
> -- 
Lew
 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to