It would crash on Android 1.x only, since starting with 2.0 the classloader 
loads the symbols only when they are reached.
No need to use reflection for that kind of test if the target is Android 
2.0+

On Saturday, September 10, 2011 1:14:39 AM UTC+2, Dianne Hackborn wrote:
>
> This will probably crash on older version of the platform, where 
> smallestScreenWidthDp isn't defined.  Is suggest using reflection to 
> retrieve that.
>
> On Fri, Sep 9, 2011 at 3:24 PM, MarkG123 <[email protected]> wrote:
>
>> This is what I am using now to have a my single APK support tablets
>> and smartphones on-the-fly.   I use if from my start activity, which
>> decides which activity to use (my app differences are more than just
>> layout).
>>
>>
>>   public boolean isTablet()
>>    {
>>        if (Build.VERSION.SDK_INT >=
>> Build.VERSION_CODES.HONEYCOMB_MR2)
>>        {
>>            return
>> (getResources().getConfiguration().smallestScreenWidthDp >= 600);
>>        }
>>
>>        return (getResources().getConfiguration().screenLayout &
>> Configuration.SCREENLAYOUT_SIZE_MASK) >=
>> Configuration.SCREENLAYOUT_SIZE_XLARGE;
>>    }
>>
>>
>>
>> This seems to work very well for me.
>>
>> --
>> 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
>>
>
>
>
> -- 
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> 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 [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

Reply via email to