开发者

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 intent开发者_如何学JAVAs..can anyone please provide codes or relevant links which may be helpful in solving this problem

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


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.


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 .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜