I am trying to create action bar using SharLock Library, I am added Sharlock library in my project.
Here is my code,
public class MainActivity extends SherlockActivity implements ActionBar.OnNavigationListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnClick=(Button)findViewById(R.id.clickMe);
btnClick.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent(MainActivity.this,ListNavigation.class);
startActivity(intent);
}
});
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
// TODO Auto-generated method stub
return false;
}
In my manifest code,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.actionbar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" android:theme="@style/Theme.Sherlock">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Once i'm using extends SherlockActivity implements ActionBar.OnNavigationListener, I am getting error like this,
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): FATAL EXCEPTION: main
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.actionbar/com.example.actionbar.MainActivity}: java.lang.ClassNotFoundException: com.example.actionbar.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.actionbar-1.apk]
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.os.Looper.loop(Looper.java:123)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at java.lang.reflect.Method.invoke(Method.java:521)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at dalvik.system.NativeStart.main(Native Method)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): Caused by: java.lang.ClassNotFoundException: com.example.actionbar.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.actionbar-1.apk]
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-23 12:56:48.811: ERROR/AndroidRuntime(3047): ... 11 more