I need to call a new Activity
through click on a ImageView
.
Follow my code:
final ImageView botaoAbrirMesas = (ImageView) findViewById(R.botoes_laucher.openMesas);
botaoAbrirMesas.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent it = new Intent();
it.setClass(null, PrincipalActivity.class);
startActivity(it);
}
});
However, running the application terminates due to an error. Is this the right way to use or can not use click on a ImageView
?