-1

I'm develop some application with a slider menu with DrawerLayout and ActionBarDrawerToggle. everything is going fine but when I'm trying to run this app in "xperia arc" device, the app crashes and not loaded! i have many devices to check the app on them: galaxy s4, galaxy 2 , galaxy note 3, Lg , sony ericsson xperia.

only in xperia the app doesnt run! what the reason!?

help me please i spend on this problem days and hours and not a clue what the reason!

Logcat error (Xperia arc) :
05-04 01:59:05.058: E/AndroidRuntime(15484): FATAL EXCEPTION: main
05-04 01:59:05.058: E/AndroidRuntime(15484): java.lang.NoSuchMethodError: com.bba.workclock.MainActivity.getActionBar
05-04 01:59:05.058: E/AndroidRuntime(15484):    at com.bba.workclock.MainActivity.settingItems(MainActivity.java:1657)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at com.bba.workclock.MainActivity.onCreate(MainActivity.java:124)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.ActivityThread.access$1500(ActivityThread.java:121)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.os.Looper.loop(Looper.java:130)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at android.app.ActivityThread.main(ActivityThread.java:3701)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at java.lang.reflect.Method.invokeNative(Native Method)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at java.lang.reflect.Method.invoke(Method.java:507)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
05-04 01:59:05.058: E/AndroidRuntime(15484):    at dalvik.system.NativeStart.main(Native Method)

Please do not downVote my question is very important to me

ANDROBIB
  • 21
  • 5

3 Answers3

0

From http://developer.android.com/guide/topics/ui/actionbar.html

Caution: Be certain you import the ActionBar class (and related APIs) from the appropriate package:

If supporting API levels lower than 11:
import android.support.v7.app.ActionBar
If supporting only API level 11 and higher:
import android.app.ActionBar
Shivam Verma
  • 7,973
  • 3
  • 26
  • 34
  • so what should i do? i cant import "android.support.v7.app.ActionBar" from my java code. i have only "android.app.ActionBar" – ANDROBIB May 03 '14 at 23:20
  • Add the android support library : http://developer.android.com/tools/support-library/setup.html – Shivam Verma May 04 '14 at 08:32
0

The ActionBar was first introduced with Android 3.0! To make it work for older android versions like 2.3.4 you can extend ActionBarActivity from the v7 support libs.

donfuxx
  • 11,277
  • 6
  • 44
  • 76
  • take a look at this guide: https://developer.android.com/tools/support-library/setup.html#add-library – donfuxx May 03 '14 at 23:36
  • ok.. i added the library but what next? what i need to change in my code? i used getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); and now after i added the lib what i need to change? – ANDROBIB May 04 '14 at 00:33
  • Better just let your Activity extend [ActionBarActivity](https://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html) – donfuxx May 04 '14 at 12:41
0

If you have added android.support.v7 library,replace every getActionBar() with getSupportActionBar()

fookwood
  • 488
  • 4
  • 10