3 messages in com.googlegroups.android-developers[android-developers] NullPointer Exce...| From | Sent On | Attachments |
|---|---|---|
| MichaMicha | 27 Jun 2008 13:12 | |
| Mark Murphy | 27 Jun 2008 15:21 | |
| MichaMicha | 28 Jun 2008 03:53 |
| Subject: | [android-developers] NullPointer Exception error at simple application![]() |
|---|---|
| From: | MichaMicha (mich...@gmail.com) |
| Date: | 06/27/2008 01:12:17 PM |
| List: | com.googlegroups.android-developers |
Hello, I'm kinda new to Android, but got some Java experience, but still got this annoying error even before i see anything on the screen:
ERROR/AndroidRuntime(1593): Uncaught handler: thread Main exiting due to uncaught exception ERROR/AndroidRuntime(1593): java.lang.RuntimeException: Unable to start activity ComponentInfo{nl.michamicha.android.androidtides/ nl.michamicha.android.androidtides.androidtides}: java.lang.NullPointerException ERROR/AndroidRuntime(1593): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1758)
(...)
ERROR/AndroidRuntime(1593): Caused by: java.lang.NullPointerException ERROR/AndroidRuntime(1593): at nl.michamicha.android.androidtides.androidtides.onCreate(androidtides.java: 22) ERROR/AndroidRuntime(1593): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 847) ERROR/AndroidRuntime(1593): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1728) ERROR/AndroidRuntime(1593): ... 11 more
This is my code:
package nl.michamicha.android.androidtides;
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button;
public class androidtides extends Activity {
Button searchButton, cancelButton;
/** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle);
searchButton = (Button) findViewById(R.id.ok); cancelButton = (Button) findViewById(R.id.cancel);
searchButton.setOnClickListener(new clicker()); cancelButton.setOnClickListener(new clicker());
setContentView(R.layout.search); }
// -----------------------------------
class clicker implements Button.OnClickListener { public void onClick(View v) { if (v == searchButton) {
} if (v == cancelButton) {
} }
} }
Can anyone help me with this problem??
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---




