I have a really strange behaviour with my tablet interface (Android > 3). When I launch it, it's like a Android 2* interface with the title at the bottom. And of course when I call the getActionBar() it returns a null.
My min-sdk & target-sdk are well set and I use the SDK Android 3.0 (11). Where am I wrong ?
public class MainScreenActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainlayout);
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar));
With the last line I get this error :
Caused by: java.lang.NullPointerException
E/AndroidRuntime( 9082): at com.shoppingscanner.tablet.MainScreenActivity.onCreate(MainScreenActivity.java:21)
E/AndroidRuntime( 9082): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
E/AndroidRuntime( 9082): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1782)
E/AndroidRuntime( 9082): ... 11 more
My Manifest (Android 3.0 used) :
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="11" />
Even if the minSdk is 11, I have this behaviour.
Thanks !