============ Problem Description ============
According to the tutorial, it generated a framework of its own problems!!! It's so ... Ask the great God to answer!
The code is as follows: (Mainactivity.java)
Package com.example.hello1;
Import android.support.v7.app.ActionBarActivity;
Import Android.os.Bundle;
Import Android.view.Menu;
Import Android.view.MenuItem;
public class Mainactivity extends Actionbaractivity {
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
}
@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}
@Override
public boolean onoptionsitemselected (MenuItem item) {
Handle Action Bar Item clicks here. The Action Bar would
Automatically handle clicks on the Home/up button, so long
As you specify a the parent activity in Androidmanifest.xml.
int id = item.getitemid ();
if (id = = r.id.action_settings) {
return true;
}
return super.onoptionsitemselected (item);
}
}
Logcat error is as follows:
09-25 13:00:43.170:d/androidruntime (979): Shutting down VM
09-25 13:00:43.170:W/DALVIKVM (979): Threadid=1:thread exiting with uncaught exception (GROUP=0XB4AA8D70)
09-25 13:00:43.190:e/androidruntime (979): FATAL Exception:main
09-25 13:00:43.190:e/androidruntime (979): Process:com.example.hello1, pid:979
09-25 13:00:43.190:e/androidruntime (979): java.lang.RuntimeException:Unable to start activity componentinfo{ Com.example.hello1/com.example.hello1.mainactivity}: Android.util.AndroidRuntimeException:You cannot combine swipe Dismissal and the action Bar.
09-25 13:00:43.190:e/androidruntime (979): at Android.app.ActivityThread.performLaunchActivity (Activitythread.java : 2197)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java : 2258)
09-25 13:00:43.190:e/androidruntime (979): at android.app.activitythread.access$800 (activitythread.java:138)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.activitythread$h.handlemessage (ActivityThread.java:1209)
09-25 13:00:43.190:e/androidruntime (979): at Android.os.Handler.dispatchMessage (handler.java:102)
09-25 13:00:43.190:e/androidruntime (979): at Android.os.Looper.loop (looper.java:136)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.ActivityThread.main (activitythread.java:5026)
09-25 13:00:43.190:e/androidruntime (979): at Java.lang.reflect.Method.invokeNative (Native Method)
09-25 13:00:43.190:e/androidruntime (979): at Java.lang.reflect.Method.invoke (method.java:515)
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:777)
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:602)
09-25 13:00:43.190:e/androidruntime (979): at Dalvik.system.NativeStart.main (Native Method)
09-25 13:00:43.190:e/androidruntime (979): caused By:android.util.AndroidRuntimeException:You cannot combine swipe Dismissal and the action Bar.
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.policy.impl.PhoneWindow.requestFeature ( phonewindow.java:275)
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.policy.impl.PhoneWindow.generateLayout ( phonewindow.java:2872)
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.policy.impl.PhoneWindow.installDecor ( phonewindow.java:3129)
09-25 13:00:43.190:e/androidruntime (979): at Com.android.internal.policy.impl.PhoneWindow.setContentView ( phonewindow.java:303)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.Activity.setContentView (activity.java:1930)
09-25 13:00:43.190:e/androidruntime (979): at Android.support.v7.app.ActionBarActivity.superSetContentView ( actionbaractivity.java:217)
09-25 13:00:43.190:e/androidruntime (979): at Android.support.v7.app.ActionBarActivityDelegateICS.setContentView ( ACTIONBARACTIVITYDELEGATEICS.JAVA:110)
09-25 13:00:43.190:e/androidruntime (979): at Android.support.v7.app.ActionBarActivity.setContentView ( actionbaractivity.java:77)
09-25 13:00:43.190:e/androidruntime (979): at Com.example.hello1.MainActivity.onCreate (mainactivity.java:15)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.Activity.performCreate (activity.java:5242)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.Instrumentation.callActivityOnCreate ( instrumentation.java:1087)
09-25 13:00:43.190:e/androidruntime (979): at Android.app.ActivityThread.performLaunchActivity (Activitythread.java : 2161)
09-25 13:00:43.190:e/androidruntime (979): ... One more
09-25 13:00:46.060:i/process (979): Sending signal. pid:979 Sig:9
============ Solution 1============
http://stackoverflow.com/questions/24587218/ Android-util-androidruntimeexception-you-cannot-combine-swipe-dismissal-and-the
============ Solution 2============
Do not use android4.4 when creating a virtual machine, and replace the target SDK in the XML file with less than 20, which is solved by someone.
============ Solution 3============
Estimated to be a version issue, find the SDK in the Pig profile Androidmanifest to the version you are using
New helloandroid onCreate NULL pointer error