Android: Application has stopped unexpectedly
<p>I'm a newbie.I was trying to take input from an Edittext in a string and show it in another edittext.The application works fine at start but when i insert the code below i start getting the error "Application stopped Unexpectedly" and after the error when i remove this code i still get the same error.I am totally confused.</p>

<p>Here is my complete class code:</p>

<pre><code> public class IOActivity extends Activity {
/** Called when the activity is first created. */
 Button button=(Button) findViewById(R.id.button1);
EditText edtxt1=(EditText) findViewById(R.id.editText1);
EditText edtxt2=(EditText) findViewById(R.id.editText2);


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
button.setOnClickListener(new View.OnClickListener() {

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
String a=edtxt1.getText().toString();   
    edtxt2.setText(a);
    }
});


}
}
</code></pre>

<p>My Android.Manifest.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.IO"
  android:versionCode="1"
  android:versionName="1.0"&gt;
  &lt;uses-sdk android:minSdkVersion="9" /&gt;

   &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;

    &lt;activity android:name=".IOActivity" 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>My Logcat shows the following Errors:</p>

<pre><code>03-19 18:30:17.938: ERROR/Zygote(32): setreuid() failed. errno: 2

03-19 18:30:29.179: ERROR/Zygote(32): setreuid() failed. errno: 17

03-19 18:30:30.868: ERROR/BatteryService(60): usbOnlinePath not found

03-19 18:30:30.868: ERROR/BatteryService(60): batteryVoltagePath not found

03-19 18:30:30.868: ERROR/BatteryService(60): batteryTemperaturePath not found

03-19 18:30:30.888: ERROR/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake

03-19 18:30:31.128: ERROR/SensorService(60): couldn't open device for module sensors (Invalid argument)


03-19 18:30:40.158: ERROR/System(60): Failure starting core service

03-19 18:30:40.158: ERROR/System(60): java.lang.SecurityException


03-19 18:30:40.158: ERROR/System(60):     at android.os.BinderProxy.transact(Native Method)

03-19 18:30:40.158: ERROR/System(60):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)

03-19 18:30:40.158: ERROR/System(60):     at android.os.ServiceManager.addService(ServiceManager.java:72)

03-19 18:30:40.158: ERROR/System(60):     at com.android.server.ServerThread.run(SystemServer.java:206)

03-19 18:30:40.188: ERROR/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter

03-19 18:30:40.188: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter

03-19 18:30:40.738: ERROR/SoundPool(60): error loading /system/media/audio/ui/Effect_Tick.ogg

03-19 18:30:40.748: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressStandard.ogg

03-19 18:30:40.748: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressSpacebar.ogg

03-19 18:30:40.748: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressDelete.ogg

03-19 18:30:40.758: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressReturn.ogg

03-19 18:30:40.808: ERROR/UsbObserver(60): java.lang.NullPointerException

03-19 18:30:40.808: ERROR/UsbObserver(60):     at 
com.android.server.UsbObserver.init(UsbObserver.java:131)

03-19 18:30:40.808: ERROR/UsbObserver(60):     at com.android.server.UsbObserver.&lt;init&gt;(UsbObserver.java:65)

03-19 18:30:40.808: ERROR/UsbObserver(60):     at com.android.server.ServerThread.run(SystemServer.java:402)

03-19 18:30:41.748: ERROR/ThrottleService(60): Could not open GPS configuration file /etc/gps.conf

03-19 18:30:41.998: ERROR/logwrapper(132): executing /system/bin/tc failed: No such file or directory

03-19 18:30:42.070: ERROR/logwrapper(134): executing /system/bin/tc failed: No such file or directory

03-19 18:30:42.118: ERROR/logwrapper(135): executing /system/bin/tc failed: No such file or directory

03-19 18:31:06.573: ERROR/MediaProvider(257): Illegal update request: can't downgrade from 305 to 92. Did you forget to wipe data?

03-19 18:31:06.823: ERROR/MediaScannerService(257): exception in MediaScanner.scan()

03-19 18:31:06.823: ERROR/MediaScannerService(257): java.lang.IllegalArgumentException

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaProvider.updateDatabase(MediaProvider.java:379)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaProvider.access$200(MediaProvider.java:83)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaProvider$DatabaseHelper.onUpgrade(MediaProvider.java:201)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:132)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaProvider.query(MediaProvider.java:1290)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.content.ContentProvider$Transport.query(ContentProvider.java:187)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.media.MediaScanner.prescan(MediaScanner.java:911)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.media.MediaScanner.scanDirectories(MediaScanner.java:1184)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaScannerService.scan(MediaScannerService.java:111)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaScannerService.access$200(MediaScannerService.java:48)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaScannerService$ServiceHandler.handleMessage(MediaScannerSe
rvice.java:267)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.os.Handler.dispatchMessage(Handler.java:99)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at android.os.Looper.loop(Looper.java:123)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at com.android.providers.media.MediaScannerService.run(MediaScannerService.java:188)

03-19 18:31:06.823: ERROR/MediaScannerService(257):     at java.lang.Thread.run(Thread.java:1019)

03-19 18:31:14.083: ERROR/AndroidRuntime(332): FATAL EXCEPTION: main

03-19 18:31:14.083: ERROR/AndroidRuntime(332): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.IO/com.example.IO.IOActivity}: java.lang.NullPointerException

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.os.Handler.dispatchMessage(Handler.java:99)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.os.Looper.loop(Looper.java:123)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread.main(ActivityThread.java:3647)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at java.lang.reflect.Method.invokeNative(Native Method)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at java.lang.reflect.Method.invoke(Method.java:507)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at dalvik.system.NativeStart.main(Native Method)

03-19 18:31:14.083: ERROR/AndroidRuntime(332): Caused by: java.lang.NullPointerException

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.Activity.findViewById(Activity.java:1647)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at com.example.IO.IOActivity.&lt;init&gt;(IOActivity.java:14)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at java.lang.Class.newInstanceImpl(Native Method)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at java.lang.Class.newInstance(Class.java:1409)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536)

03-19 18:31:14.083: ERROR/AndroidRuntime(332):     ... 11 more
</code></pre>
