Created
July 3, 2012 02:57
-
-
Save levinotik/3037245 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment