chetan
chetan

Reputation: 1395

passing arrays between classes using intents

i am developing a final year project where i need to retrieve details of hospitals like name ,address, location(in terms of latitude and longitude) from a server and display them on a map....connectivity has been established and i am able to retrieve the values in the from of array like address[], name[] etc..

now i need to pass these values from an activity class to map activity class...i am new to intents..can anyone please provide codes or relevant links which may be helpful in solving this problem

any help will be really appreciated....cheers :)

Upvotes: 1

Views: 1301

Answers (2)

Chirag
Chirag

Reputation: 56935

I Suggest store that all necessary data in static list and then use that static .

public static List<String> name = new ArrayList<String>();
public static List<String> address = new ArrayList<String>();
public static List<String> latitude = new ArrayList<String>();
public static List<String> longitude = new ArrayList<String>();

name.add("your data");
address .add("your data");
latitude .add("your data");
longitude .add("your data");

then you can get all the data in any activity .

Upvotes: 0

Ted Hopp
Ted Hopp

Reputation: 234857

You can add data to an Intent using one of the putExtra routines. But serializing large amounts of data is expensive. Take a look here for alternatives.

Upvotes: 1

Related Questions