onclick event in android code example
Example 1: onclick listener android
Button myButton;
awesomeButton = new Button(this);
awesomeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this,NewActivity.class));
});
}
Example 2: onclick method android
public void clickFunction (View view){}