Sunday, January 20, 2013

Backward compatibility super quick

Setting up a project with ActionBar, NavigationTabs and swipe navigation in less than 2 minutes!

I have always appreciated how Action bar Sherlock provides the latest navigation features for the devices with lower versions of android , but only today did I realize that it is also super easy to configure. Make sure you have the latest versions of ADT and actiobarsherlock configured with your eclipse and follow the steps below to get you project running in less than 2 minutes.

Step 1.

In eclipse navigate to File->New->Other->Android Application Project. Enter the project details and set the Mininum Required SDK,Target SDK and Compile With with the highest available values(must be >11).
Click Next and setup the other values also in the following 2 screens.

Step 2.

Under the Create Activity screen,choose BlankActivity  and in the following screen select either of the options depending on how you want the navigation in your project.

Step 3

Delete the libs\android-support-v4.jar from the project and add the one present in the ActionBar Sherlock project.This is because the project might not compile if the versions of the jars mismatch.

Step 4
Navigate to project Properties->Android->Add Library and add the Action bar project.

Step 5 

Open the Activity's java file and replace the following:
FragmentActivity  ---> SherlockFragmentActivity
getActionBar ---> getSupportActionBar()
gettMenuInflater() --> getSupportMenuInflater()

Step 6 

Remove all imports from the java file and press ctrl+shift+o . Select the packages from the Sherlock Action Bar project for import when prompted.

Step 7

Open the AndroidManifest.xml file and change the minimun sdk version to 8 and the theme to Theme.Sherlock.Light.

This is all and your project would run like a charm on all versions of Android.



Friday, January 18, 2013

Android 4.2 Yet another power user tip!

Should I call it an Easter egg or a power user feature?
  1.  Navigate to the Contacts/People application on your Android 4.2 device and search "debug debug!" 
  2. Click Export database files
  3. click Send

As per the message, you can email yourself the backup of all the contacts, email and call logs.

  

Wednesday, January 2, 2013

Development options Android 4.2

In a move to make the platform more user friendly, Google has hidden the otherwise visible "Developer options" menu for the versions 4.2(and above??). So if you are a developer and wandering where to enable USB debugging for your shining new Nexus,  just navigate to Settings > About tablet and tap on the Build Number a few times and the menu will appear at its usual place.
Don't forget to tap on the Android Version a few times too and shoot some jelly beans ;)