title: Sorry the application (app name) has stopped unexpectedly. Please try again
body: <p>I am trying to run the following codes in ADT and whenever i try to run it as an android application , i have the error as stated in the title.</p>
  
  <p>This is the code in the .java file.</p>
  
  <pre><code>     package sp.com;
  
      import android.os.Bundle;
      import android.support.v7.app.ActionBarActivity;
      import android.view.Menu;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.RadioGroup;
      import android.widget.Toast;
  
      public class RestaurantList extends ActionBarActivity {
  
          private EditText name;
          private RadioGroup restaurantTypes;
          private Button save;
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.main);
  
              name = (EditText) findViewById(R.id.name);
              restaurantTypes = (RadioGroup) findViewById(R.id.types);
  
              save = (Button) findViewById(R.id.save);
              save.setOnClickListener(onSave);
          }
  
          private View.OnClickListener onSave = new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  String nameStr = name.getText().toString();
  
                  String restType = "";
  
                  switch (restaurantTypes.getCheckedRadioButtonId()){
                  case R.id.chinese:
                      restType = "Chinese";
                      break;
                  case R.id.indian:
                      restType = "Indian";
                      break;
                  case R.id.western:
                      restType = "Western";
                      break;
                  case R.id.indonesian:
                      restType = "Indonesian";
                      break;
                  case R.id.korean:
                      restType = "Korean";
                      break;
                  case R.id.japanese:
                      restType = "Japanese";
                      break;
                  case R.id.thai:
                      restType = "Thai";
                      break;
                  }
                  String combineStr = nameStr + "\n" + restType;
                  Toast.makeText(v.getContext(), combineStr, Toast.LENGTH_LONG).show();
              }
          };
  
  
          @Override
          public boolean onCreateOptionsMenu(Menu menu) {
  
              // Inflate the menu; this adds items to the action bar if it is present.
              getMenuInflater().inflate(R.menu.restaurant_list, menu);
              return true;
          }
      }
  </code></pre>
  
  <p>And here is the fragment_restaurant_list.xml file.</p>
  
  <pre><code>    &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/ScrollView"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;TableLayout
          android:id="@+id/TableLayout1"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:paddingBottom="@dimen/activity_vertical_margin"
          android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:paddingTop="@dimen/activity_vertical_margin"
          android:stretchColumns="1"
          tools:context="sp.com.RestaurantList$PlaceholderFragment" &gt;
  
          &lt;TableRow
              android:id="@+id/tableRow1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:id="@+id/textView1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Name : " /&gt;
  
              &lt;EditText
                  android:id="@+id/name"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:ems="10" &gt;
  
                  &lt;requestFocus /&gt;
              &lt;/EditText&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:id="@+id/textView2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Add :" /&gt;
  
              &lt;EditText
                  android:id="@+id/add"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:ems="10"
                  android:inputType="textPostalAddress" /&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow3"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:id="@+id/textView3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Tel :" /&gt;
  
              &lt;EditText
                  android:id="@+id/telephone "
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:ems="10"
                  android:inputType="phone" /&gt;
          &lt;/TableRow&gt;
  
          &lt;TableRow
              android:id="@+id/tableRow4"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:id="@+id/types"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Type" /&gt;
  
              &lt;RadioGroup
                  android:id="@+id/radioGroup1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;RadioButton
                      android:id="@+id/chinese"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:checked="true"
                      android:text="Chinese" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/indian"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Indian" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/western"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Western" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/indonesian"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Indonesian" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/korean"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Korean" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/japanese"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:checked="true"
                      android:text="Japanese" /&gt;
  
                  &lt;RadioButton
                      android:id="@+id/thai"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="Thai" /&gt;
  
              &lt;/RadioGroup&gt;
  
          &lt;/TableRow&gt;
  
          &lt;Button
              android:id="@+id/save"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Save" /&gt;
  
      &lt;/TableLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Here is the manifest.xml file.</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="sp.com"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="19" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="sp.com.RestaurantList"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Here is the logcat :</p>
  
  <pre><code>05-03 14:40:33.382: E/Zygote(32): setreuid() failed. errno: 2
  
  05-03 14:40:45.852: E/Zygote(32): setreuid() failed. errno: 17
  
  05-03 14:40:47.522: E/BatteryService(60): usbOnlinePath not found
  
  05-03 14:40:47.522: E/BatteryService(60): batteryVoltagePath not found
  
  05-03 14:40:47.522: E/BatteryService(60): batteryTemperaturePath not found
  
  05-03 14:40:47.542: E/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
  
  05-03 14:40:47.642: E/SensorService(60): couldn't open device for module sensors (Invalid argument)
  
  05-03 14:40:54.203: E/System(60): Failure starting core service
  
  05-03 14:40:54.203: E/System(60): java.lang.SecurityException
  
  05-03 14:40:54.203: E/System(60):   at android.os.BinderProxy.transact(Native Method)
  
  05-03 14:40:54.203: E/System(60):   at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
  
  05-03 14:40:54.203: E/System(60):   at android.os.ServiceManager.addService(ServiceManager.java:72)
  
  05-03 14:40:54.203: E/System(60):   at com.android.server.ServerThread.run(SystemServer.java:206)
  
  05-03 14:40:54.233: E/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter
  
  05-03 14:40:54.233: E/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter
  
  05-03 14:40:54.873: E/SoundPool(60): error loading /system/media/audio/ui/Effect_Tick.ogg
  
  05-03 14:40:54.893: E/SoundPool(60): error loading /system/media/audio/ui/KeypressStandard.ogg
  
  05-03 14:40:54.913: E/SoundPool(60): error loading /system/media/audio/ui/KeypressSpacebar.ogg
  
  05-03 14:40:54.933: E/SoundPool(60): error loading /system/media/audio/ui/KeypressDelete.ogg
  
  05-03 14:40:54.933: E/SoundPool(60): error loading /system/media/audio/ui/KeypressReturn.ogg
  
  05-03 14:40:54.993: E/UsbObserver(60): java.lang.NullPointerException
  
  05-03 14:40:54.993: E/UsbObserver(60):  at com.android.server.UsbObserver.init(UsbObserver.java:131)
  
  05-03 14:40:54.993: E/UsbObserver(60):  at com.android.server.UsbObserver.&lt;init&gt;(UsbObserver.java:65)
  
  05-03 14:40:54.993: E/UsbObserver(60):  at com.android.server.ServerThread.run(SystemServer.java:402)
  
  05-03 14:40:55.663: E/ThrottleService(60): Could not open GPS configuration file /etc/gps.conf
  
  05-03 14:40:56.363: E/logwrapper(136): executing /system/bin/tc failed: No such file or directory
  
  05-03 14:40:56.453: E/logwrapper(138): executing /system/bin/tc failed: No such file or directory
  
  05-03 14:40:56.473: E/logwrapper(140): executing /system/bin/tc failed: No such file or directory
  
  05-03 14:41:39.030: E/AndroidRuntime(336): FATAL EXCEPTION: main
  
  05-03 14:41:39.030: E/AndroidRuntime(336): java.lang.RuntimeException: Unable to start activity ComponentInfo{sp.com/sp.com.RestaurantList}: java.lang.NullPointerException
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.os.Handler.dispatchMessage(Handler.java:99)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.os.Looper.loop(Looper.java:123)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread.main(ActivityThread.java:3683)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at java.lang.reflect.Method.invokeNative(Native Method)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at java.lang.reflect.Method.invoke(Method.java:507)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at dalvik.system.NativeStart.main(Native Method)
  
  05-03 14:41:39.030: E/AndroidRuntime(336): Caused by: java.lang.NullPointerException
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at sp.com.RestaurantList.onCreate(RestaurantList.java:30)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  
  05-03 14:41:39.030: E/AndroidRuntime(336):  ... 11 more
  : E/(): Device disconnected: 1
  : E/(): Device disconnected
  </code></pre>
  
  <p>Thank you so much in advance and as i am a beginner , i will appreciate it if the terms used are simple. </p>