[Solved] How can I pass parameters between two activities?


Firstly i want to say that you have lots of error in your code. yo should make more improvement in its quality. read more.

now answer to your question.

  • You have to start the activity in Active.java to send it to Active2.java activity.
  • You have to give create new intent in Active.java and this will help you to put all the intent values into the intent.
  • Then you can start the startActivity() and start the Active2.java.
  • Then only you will have those values in the Active2.java and you can retrive all those values here.

so it would be like this

in Active.java

    Intent intent = new intent(Active.this,Active2.class);
    intent.putExtra("point", point);
    intent.putExtra("Active",1);
    startActivity(intent);

in Active2.java

    Intent intent=getIntent();
    String point=intent.getStringExtra("point");
    int Active=intent.getIntExtra("Active");

solved How can I pass parameters between two activities?