Another thing you can do is check the API level...  I do that for a few
features in my app.  Then you don't have to use reflection.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Aug 2, 2012 at 8:51 AM, G. Blake Meike <[email protected]>wrote:

> Many of the features in 4.1 can also be found in the Support Package
> (formerly the ACL).  Depending on the exact features you need, you may be
> able to build your app for 4.1 and then backport it to 2.2, by adding the
> Support Library to the project.
>
> G. Blake Meike
> Marakana
>
> The second edition of Programming Android is now on-line:
> http://shop.oreilly.com/product/0636920023005.do
>
>
> On Thursday, August 2, 2012 7:45:56 AM UTC-7, Jeremy Villalobos wrote:
>>
>> Yes
>>
>> Do note that some API calls will throw Exceptions on Froyo.  To avoid
>> this, use Reflections
>>
>> For example: my app supports from Froyo upward, but Froyo does not
>> support icons on the Preference Activity.  So I use this to set the icon
>> for ICS, and skip the step on Froyo
>>
>>  void workAroundSetPicture(**Preference pref, int resource){
>>     try {
>> Method m = pref.getClass().getMethod("**setIcon", int.class);
>>  m.invoke( pref,  resource );
>> } catch (SecurityException e) {
>> e.printStackTrace();
>>  } catch (NoSuchMethodException e) {
>> e.printStackTrace();
>> } catch (IllegalArgumentException e) {
>>  e.printStackTrace();
>> } catch (IllegalAccessException e) {
>> e.printStackTrace();
>>  } catch (InvocationTargetException e) {
>> e.printStackTrace();
>> }
>>     }
>>
>> The top right corner on the Android Developer documentation mentions for
>> which Version the methods were introduced.
>>
>> On Wednesday, August 1, 2012 10:27:06 AM UTC-4, Eric oboite wrote:
>>>
>>> When creating my new app should I build against 2.2 or 4.1? I know 2.2
>>> has 83% of the market right now but can I build against 4.1 and make the
>>> min sdk android 2.0?
>>>
>>>  --
> 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

Reply via email to