getActionBar and targetSdkVersion in Android development


Hi All,Recently I was trying to reiterate Android docs training just to fill in anything I missed previously. There I came across this piece of code:

// Initialize member TextView so we can manipulate it later  
     mTextView = (TextView) findViewById(R.id.edit_message);  
     // Make sure we're running on Honeycomb or higher to use ActionBar APIs  
     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {  
       // For the main activity, make sure the app icon in the action bar  
       // does not behave as a button  
       ActionBar actionBar = getActionBar();  
       actionBar.setHomeButtonEnabled(false);  
     }

I tried to put that in a simple hello world example and it worked on an 2.2 emulator, however it failed to run on 4.0 emulator. On debugging it turned out that getActionBar was returning null value. Though there was on-line help available for some other directions it just came to my mind to check AndroidManifest.xml file. There I saw only “android:minSdkVersion=”8″” I remembered that there was a target SDK  as well which can be defined. So I checked a project created by eclipse and found the “android:targetSdkVersion=”15″” line and added it to “uses-sdk ” tag in AndroidManifest.xml and the app started working on 4.0 emulator.

This clears two things, first is that Idea IDE adds only minSDKVersion while eclipse adds targetSDKVersion as well. Which is reflected in new project also but could effect like this.

Second, if you search for getActionBar returning null you get loads of advice but maybe not this. So check if you are having this issue.

Thanks for reading. Thanks for Android guys for creating such a good documentation, which by and large so much better than Facebook developer docs. Only wish Facebook docs were also as clear as the Android docs.

Nexus 4 unboxing and first impressions


Google’s newest flagship handset, the LG Nexus, 4 is finally upon us. The highly anticipated stock Android smartphone features some of the highest-end specs of any phone currently on the market, but does it manage to satisfy? Stay tuned for a complete review. However, in the meantime, be sure to catch our unboxing and first impressions below.

http://supertechblog.com/2012/11/17/nexus-4-unboxing-and-first-impressions/

via Blogger http://ashish-yadav.blogspot.com/2012/11/nexus-4-unboxing-and-first-impressions.html

How to change look & feel of NetBeans IDE and application


Standard GUI toolkit of Java is Swing. NetBeans IDE and Platform is written in Swing. It’s widely used and accepted. It’s cross-platform and it’s doesn’t look very well under (GTK+) Linux.Read more here:http://devblog.virtage.com/2011/09/how-to-change-look-feel-of-netbeans-ide-and-application/

via Blogger http://ashish-yadav.blogspot.com/2012/11/how-to-change-look-feel-of-netbeans-ide.html