tags:

views:

95

answers:

2

I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.

For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.

I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?

Many thanks.

+2  A: 

you could use the Intent's 'extras' bundle to pass all the info you need to the next activity.

Reflog
+3  A: 

Within the Main activity

    Intent I = new Intent(this, Child.class);
    Bundle bundle = new Bundle();
    bundle.putString("field name1", "data1");
    bundle.putString("field name2", "data2");
    Info.putExtras(bundle);
    startActivity(I);

Within the onCreate of Child.class

Bundle bundle = getIntent().getExtras();
String data1 = bundle.getString("field name1");
String data2 = bundle.getString("field name2");
Martin Marinov