Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- somewhere in my Android activity:
- new Button().setOnClickListener(
- new OnClickListener() {
- public void onClick(View v) {
- println(v.getId + "was clicked");
- }
- }
- public interface OnClickListener(View v); //no method body defined
- or
- public class MyAndroidAppActivity extends Activity implements OnClickListener {
- new Button().setOnClickListener(this) //where this is the click
- @Override // just a helpful annotation for the reader
- public void onClick(View v) {
- println(v.getId + "was clicked");
- }
- }
Add Comment
Please, Sign In to add comment