skyshine
skyshine

Reputation: 2864

Navigation Drawer is not working in android 2.3

I tried navigation drawer it worked fine in android 4.1 Then I tried in gingerbread,I added supported library appcompat still also I am getting error please help me

01-02 16:48:04.765: E/AndroidRuntime(4688): FATAL EXCEPTION: main
01-02 16:48:04.765: E/AndroidRuntime(4688): java.lang.NoSuchMethodError: com.javatechig.drawer.MainActivity.getActionBar
01-02 16:48:04.765: E/AndroidRuntime(4688):     at com.javatechig.drawer.MainActivity.onCreate(MainActivity.java:40)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.os.Looper.loop(Looper.java:130)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at android.app.ActivityThread.main(ActivityThread.java:3687)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at java.lang.reflect.Method.invokeNative(Native Method)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at java.lang.reflect.Method.invoke(Method.java:507)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
01-02 16:48:04.765: E/AndroidRuntime(4688):     at dalvik.system.NativeStart.main(Native Method)

Upvotes: 0

Views: 2352

Answers (4)

Paresh Mayani
Paresh Mayani

Reputation: 128428

Use getSupportActionBar(), which is a support library version of getActionBar().

To use all the support methods, you need to extend ActionBarActivity class instead of Activity class.

Upvotes: 3

VINIL SATRASALA
VINIL SATRASALA

Reputation: 634

This is because they are using Actionbar, action bar supports from 3.0 onwards. In order to support for 2.3 they need to use sherlock action bar. See this: http://actionbarsherlock.com/

Upvotes: 0

Sandip_Jahdav
Sandip_Jahdav

Reputation: 147

The Actionbar is added in android 3.0 so it is not supported in android 2.3 So Use the Go to The Link and download the library and add it to your project.

Upvotes: -1

M D
M D

Reputation: 47817

Try using ActionBar Sherlock instead. Here are some good tutorials for it:http://www.androidbegin.com/tutorial/implementing-actionbarsherlock-side-menu-navigation-with-fragment-tabs-tutorial/

This should help you see the difference between ActionBarCompat and ActionBarSherlock.Difference between ActionBarSherlock and ActionBar Compatibility

Upvotes: 0

Related Questions