Reputation: 141
i try to transfer data from one activity to another but i can't achieve it.. can any one assit me.. kindly assit with example... thanks in advance..
Upvotes: 1
Views: 2764
Reputation: 1630
Only primitive data types like string, integers etc can be passed. Also you can pass ArrayList etc. Object cannot be passed. Following are a few lines of code to explain:
From the activity you want to send data
Intent intent = new Intent(this,NewActivity.class);
intent.putExtra("LABEL", <data>);
In the new activity:
Bundle bundle = getIntent().getExtras();
data = bundle.getInt("LABEL");
Upvotes: 2
Reputation: 581
Use Intent
to transfer you data from Activity
to another. Check out Android Developer | Intents and Intent Filters and Android Developer | Intent documentation
Upvotes: 0