.NET Developer here just getting started with Eclipse and Android.
Can someone show me in the simplest way possible, with the absolute fewest lines of code, how to D
Taken from: http://developer.android.com/guide/topics/ui/ui-events.html
// Create an anonymous implementation of OnClickListener
private OnClickListener mCorkyListener = new OnClickListener() {
public void onClick(View v) {
// do something when the button is clicked
}
};
protected void onCreate(Bundle savedValues) {
...
// Capture our button from layout
Button button = (Button)findViewById(R.id.corky);
// Register the onClick listener with the implementation above
button.setOnClickListener(mCorkyListener);
...
}