Hi all.
I'm just learning how to develop for android. I'm using Eclispe Ganymede
3.4.1 with ADT 0.8.0.v200809220836-110569 and jdk 1.6.0_10. I have created
a test app wherein I put some text and a button on the screen. the program
loads and runs in the emulator just fine, but when I click the button, I
want it to give me some text feedback that the button was clicked, but
nothing happens. Below is my java code:
package test.app;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;
public class test_app extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/* Find the button from our XML-layout. */
Button b = (Button)this.findViewById(R.id.btn_open_search);
b.setOnClickListener(new OnClickListener() {
public void onClick(View agr0) {
// Place code to handle button click here
System.out.println("Button clicked");
}
});
}
}
Is there a different way I should be doing this than using
system.out.println()? Any suggestions are welcome. Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---