I'm writing an application in android studio IDE which shows the models,brands ,prices and etc of the cars and I want to move from one activity to another one.can I use putExtra?if yes i wonder if anyone would like to tell me how can i use it.
Asked
Active
Viewed 3,583 times
3 Answers
1
You can pass data between activities in easiest way like this.
In the first activity use out extra to send the data
Intent intent = new Intent(getBaseContext(), SignoutActivity.class);
intent.putExtra("YOUR_DATA_KEY", data);
startActivity(intent);
Access that intent on next activity like this
String s = getIntent().getStringExtra("YOUR_DATA_KEY");
Sharath kumar
- 3,976
- 1
- 12
- 20
0
try this
Intent intent=new Intent(this,YourActivity.class);
intent.putExtra("key",value);
startActivity(intent);
Arun Vinoth - MVP
- 21,521
- 14
- 57
- 157
J Ramesh
- 538
- 4
- 10
-1
Try the following
Intent intent =new Intent(FirstActivity.this,SecondeActivity.class);
StartActivity(intent);
Amrutha Saj
- 1,378
- 14
- 34
Swapnil Wakchaure
- 55
- 6