0
I need to call a new Activity
through the click in a ImageView
.
Follows 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, when running the application terminates due to an error. This is the right way to use or I cannot use click in a ImageView
?
In addition to doing what @ramaral posted, be sure to declare the new Activity on
AndroidManifest.xml
<Activity android:name="com.package.app. Nameserve" android:label="Nameserve" > </Activity>– iTSangar
Thank you for remembering that. But the activity to declare is
PrincipalActivity
and notNomeDaSuaActividade
. At least in the context whereNomeDaSuaActividade
is used in my example.– ramaral