raqz wrote:
> I have this main class which displays a button and on click of the
> button, the NextActivity class should be called. I have defined the
> NextActivity class in the same package. But when I click the button,
> the application closes stating there is some error.

Use adb logcat, DDMS, or the DDMS perspective in Eclipse to find the
Java stack trace for your error.

In this case, it will be something about your Intent being malformed:

>                 Intent i = new Intent();
>                 i.setClassName("com.intents", "NextActivity");
>                 startActivity(i);

The above Intent is different than the one you said works:

>        //startActivity(new Intent( this, NextActivity.class));

Your first Intent does not have any sort of Context (e.g., your
Activity) associated with it, and so it will result in some exception
when you try to use it.

Instead, use the form of your second Intent, though you will need to
make it be MainClass.this instead of just "this" for it to compile.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to