Share this post on:

You can easily Parse data in Android from activity one to another by using putExtra() in Android Java Class.

You have to pass putExtra() with you intent where you want to move the data.

Example:

Step 1: Putting PutExtra() with you intent

Intent intent = new Intent(Login.this, Otp.class);
intent.putExtra("id", Id);
intent.putExtra("mobilenumber", MobileNumber);
intent.putExtra("otp", OTP);

Step 2: Getting those data from previous activity usign that denoted keyword

if (savedInstanceState == null) {
Bundle extras = getIntent().getExtras();
if(extras == null) {
mobile= null;
OTP= null;
id=null;

} else {
mobile= extras.getString("mobilenumber");
OTP= extras.getString("otp");
id= extras.getString("id");

}
} else {
mobile= (String) savedInstanceState.getSerializable("mobilenumber");
OTP= (String) savedInstanceState.getSerializable("otp");
id= (String) savedInstanceState.getSerializable("id");
}

Output: You will get your data in another activity.

Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.

Leave a Comment

Your email address will not be published. Required fields are marked *