Reputation: 1259
How can I pass an big json-string between activities fast?
a) My Activity one look like this.
JsonDataTask jdt = new JsonDataTask(c);
AsyncTask<String, Integer, String> rdataJSON = jdt.execute("https://job.jobnet.dk/FindJobService/V1/Gateway.ashx/annonce?fritekst=akutjob&sortering=match");
try {
Intent i = new Intent(c, JoblistActivity.class);
i.putExtra("rdataJSON", rdataJSON.get());
startActivity(i);
} catch (InterruptedException e1) {
e1.printStackTrace();
} catch (ExecutionException e1) {
e1.printStackTrace();
}
b) Then Activity two below.
Intent intent = getIntent();
JobPosting_json = intent.getStringExtra("rdataJSON");
The problem is where the 'jdt.execute()' a.k.a json-string return too must data.. Then the 'getStringExtra("rdataJSON")' can´t holde the hule string..
Upvotes: 1
Views: 738
Reputation: 11177
So two solutions:
I usually go for the second option but it all depends on your requirements.
Upvotes: 0
Reputation: 2263
You want to use Parcelable class to one activity to another, Refer http://developer.android.com/reference/android/os/Parcelable.html
Upvotes: 1