Look at the Logcat output... ---------------------------------------------------------------------- There are only 10 types of people in the world... Those who know binary and those who don't. ----------------------------------------------------------------------
On Fri, Oct 2, 2009 at 10:15 AM, sbruno74 <sbrun...@gmail.com> wrote: > > Hello, > > I am working on a simple application that, for now, just presents a > login page as the starting activity with username and password and a > login button. When you click on the login button, it starts a new > activity after verifying credentials. When I run the application in > the emulator, it stops unexpectedly without even showing the main > activity with this error message : The application ... has stopped > unexpectedly. Please try again later. > > It seems that it is the code where I register a listener for the > button click that causes the crash because when I comment the code, at > leas the application starts normally. I can't find the error. Here's > my onCreate method where I register the listener: > > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > Button loginButton = (Button) findViewById(R.id.login); > > loginButton.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > EditText usernameView = (EditText) findViewById > (R.id.username); > EditText passwordView = (EditText) findViewById > (R.id.password); > mUsername = usernameView.getText().toString(); > mPassword = passwordView.getText().toString(); > if (verifyLogin()) { > callHome(); > } > } > }); > } > > For now, verifyLogin() does nothing and just returns true. The callHome > () method just builds an intent, registers username and password as > extras and starts the other activity with the intent. > > When I comment the setOnClickListener() call, I do not get the error. > > Please what did I do wrong? > > I run eclipse 3.5 with the ADT plugin on Windows Vista 64-bit. > > Stéphane > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---