Thanks Yusuf for your reply! I do actually have the Tag activity in the manifest, the manifest snipit I posted had a typo (thanks for catching that). What else may cause such a problem?
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Yusuf Saib (T-Mobile USA) Sent: Friday, August 28, 2009 12:10 PM To: Android Beginners Subject: [android-beginners] Re: Source not found You may need to add the Tag activity to your AndroidManifest.xml file. Yusuf Saib Android ·T· · ·Mobile· stick together The views, opinions and statements in this email are those of the author solely in their individual capacity, and do not necessarily represent those of T-Mobile USA, Inc. On Aug 27, 5:19 pm, "tinyang" <[email protected]> wrote: > Hello. > When I click on a button in my app, I get a "Class file editor/source > not found" message. I'm not sure why this is a problem because I have > other buttons that do the same thing (start an activity) and they do > not have this problem. If anyone has suggestions, it would be much appreciated! > > Below is the logcat out put and the code/xml involved: > > Button code: > next1btn = (Button) findViewById(R.id.next1btn); > > next1btn.setOnClickListener(new View.OnClickListener() { > > public void onClick(View v) { > > startActivity(new Intent(TakePic.this, Tag.class)); > > } > > }); > > Button xml: > > <Button android:id="@+id/next1btn" > > android:layout_width="wrap_content" > > android:layout_height="wrap_content" > > android:text=" Next " /> > > AndroidManifest.xml intent: > > <activity android:name=".Tag" > > android:label="@string/app_name"> > > <intent-filter> > > <action android:name="android.intent.action.MAIN" /> > > </intent-filter> > > </activity> > > Tag.java: > > package net.tiny.racker; > > import android.app.Activity; > > import android.content.Intent; > > import android.os.Bundle; > > import android.view.View; > > import android.widget.Button; > > import android.widget.Toast; > > public class Tag extends Activity { > > Button tagbtn = null; > > Button next2btn = null; > > @Override > > protected void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > Tagbtn = (Button) findViewById(R.id.tagbtn); > > Tagbtn.setOnClickListener(new View.OnClickListener() { > > public void onClick(View v) { > > Toast.makeText(Tag.this, "Tag coming soon", 5000).show(); > > } > > }); > > next2btn = (Button) findViewById(R.id.next2btn); > > next2btn.setOnClickListener(new View.OnClickListener() { > > public void onClick(View v) { > > startActivity(new Intent(Tag.this, Guide.class)); > > } > > }); > > } > } > > Logcat: > > 08-28 00:03:00.637: INFO/ActivityManager(50): Starting activity: > Intent { comp={net.tiny.racker/net.tiny.racker.Tag} } > 08-28 00:03:00.678: DEBUG/AndroidRuntime(242): Shutting down VM > 08-28 00:03:00.687: WARN/dalvikvm(242): threadid=3: thread exiting > with uncaught exception (group=0x4000fe68) > 08-28 00:03:00.687: ERROR/AndroidRuntime(242): Uncaught handler: > thread main exiting due to uncaught exception > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): java.lang.RuntimeException: > Unable to start activity ComponentInfo{net.tiny.racker/net.tiny.racker.Tag}: > java.lang.NullPointerException > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2 > 141) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:21 > 57) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread.access$1800(ActivityThread.java:112) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1581) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.os.Handler.dispatchMessage(Handler.java:88) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.os.Looper.loop(Looper.java:123) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread.main(ActivityThread.java:3739) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > java.lang.reflect.Method.invokeNative(Native Method) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > java.lang.reflect.Method.invoke(Method.java:515) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit. > java: 7 > 39) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > dalvik.system.NativeStart.main(Native Method) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): Caused by: > java.lang.NullPointerException > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > net.tiny.racker.Tag.onCreate(Tag.java:19) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: > 1122) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2 > 104) > 08-28 00:03:00.707: ERROR/AndroidRuntime(242): ... 11 more > > -- > :-) > P Please don't print this e-mail unless you really need to. No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.169 / Virus Database: 270.13.71/2330 - Release Date: 8/27/2009 6:02 PM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

