Hi, In the first case you were trying to use the Activity's main view OnClick(), this won't work though.
In the second case did you check the debug log? (DDMS debug output) that second version writes to the log. Also, in order to debug you need to have android:debuggable="true" in your application manifest. If you don't it wont stop on breakpoints or anything, you will get an error in the log but it may be hard to spot. -niko On Dec 6, 11:55 pm, launchpadtt <[email protected]> wrote: > Hello, > > I'm currently baffled about something. It seems like a genuine bug in > the SDK. > > I have an activity that was the main activity for my program. It > consisted of 3 buttons. I added a third using the wysiwyg editor in > eclipse > > <Button android:layout_width="wrap_content" > android:layout_height="wrap_content" android:id="@+id/buttonauthor" > android:text="Also by Author"></Button> > > then I made a variable to refer to it in my activities onCreate() for > the activity which implements > > whatthehell=(Button)findViewById(R.id.buttonauthor); > whatthehell.setOnClickListener(this); > > then I made the OnClick Listener toast > > public void onClick(View view) { > if (view == whatthehell) { > Toast.makeText(this, "clicked button02", 2000).show(); > } > } > > When I ran it, it didn't click. When I debug it, it didn't even go > into the onClick method. > > I tried to give it its own anonymous OnClick listener and it did the > same behaviour > > whatthehell.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > // TODO Auto-generated method stub > Log.v("Clicked the author button", "Pressed the author > button"); } > }); > > I thought something may have been wrong with the emulator image, but I > tried it on a separate installation of Eclipse and had to make a new > emulator image for it. and it still did the same thing. > > Am I missing anything? -- 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

