onClick listener in java component in android code example
Example: 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));
});
}