A couple of useful tips on this and phone/tablet apps in general:
- Since ActionBarSherlock is included via Android's shared project feature (it can't be done as a JAR file because it has resources that need to be referenced by your app), you have to make sure your resource filenames don't collide with the ones in that library (same is true of any shared projects you include via Properties\Android\Libraries).
- ActionBar, Menu, and MenuItem need to be referenced using android.support.v4.* prefixes instead of android.* prefixes when using the AndroidBarSherlock library.
- To get the action bar in AndroidSherlock, you hae to replace getActionBar() (from the official Fragment API) with getSupportActionBar().
- If you get java.lang.ClassNotFoundException when you try to run your app on phone versions of Android, it means you're referencing Honeycomb or higher APIs (this includes stuff like ObjectAnimator, ClipData, PropertyValuesHolder, etc.) that you need to remove or; unfortunately Java doesn't tell you what class it's looking for.
- If you use methods not in the API version you're running on, you'll get MethodNotFoundException but at least the JVM tells you which method you're failing on in LogCat.
- If you use color or image IDs that are in Honeycomb (e.g., "?android:attr/actionBarSize" or "?android:attr/activatedBackgroundIndicator" in layouts) , your application will blow up inflating those resources when run on smartphones.
- The rest of the caveats are the same as the ACL: all Activities should be FragmentActivities, you need to call getSupport*() instead of get*().
- Yes, you still have to do (android.os.Build.VERSION.SDK_INT > 10) to do special Honeycomb stuff but at least your code is now mostly the same.
- ObjectAnimators aren't available in older phone operating system versions, so if you use this for eye candy, you have to check the SDK version.
- ClipData isn't available on older Android versions so if you're using this for drag/drop, you'll have prevent it from being run on older Android versions.
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |