how to start a new activity in Android studio Kotlin code example
Example 1: start new activity kotlin
val intent = Intent(this, NextActivity::class.java)
intent.putExtra("keyIdentifier", value)
startActivity(intent)
Example 2: go to activity android
btListe = (ImageButton)findViewById(R.id.Button_Liste);
btListe.setOnClickListener(new OnClickListener()
{ public void onClick(View v)
{
intent = new Intent(main.this, ListViewImage.class);
startActivity(intent);
finish();
}
});
Example 3: navigate to another activity in android
OnClickListener onClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(action));
}
};
Button button = (Button) findViewById(id);
button.setOnClickListener(onClickListener);