Android Open Activity

Android Open Activity from FirstActivity

    Intent intent = new Intent(this, SecondActivity.class);
    intent.putExtra(EXTRA_MESSAGE, someMessage);


If you are trying inside onclick listener better to use Activity_Name.this insted of this

Intent intent = new Intent(FirstActivity.this, SecondActivity.class);

No data to send

startActivity(new Intent(FirstActivity.this, SecondActivity.class));


Receiving the Intent from Second Activity

Intent intent = getIntent();

String message = intent.getStringExtra(FirstActivity.EXTRA_MESSAGE);



Author: bm on May 31, 2016
Category: Android

Your comment:

Your Name


Last articles