harsha vardhan harsha vardhan - 4 months ago 14
Android Question

Change the data in TextView for every different parameter passed in Intent

I have a

TabHost
containing 7 tabs and have 10 items(listView) in each tab. It is highly impossible to create 70
Intent
s to handle request from each item.So can anyone provide the best way to handle them like one intent for each tab (i.e. for 10 items) but with different data. Just the data in
TextView
changes.

Answer

You can pass data using intent will launching it.

Add data like this

    Intent intent = new Intent(current.this, AndroidTabRestaurantDescSearchListView.class);
    intent.putExtra("keyName","value");
    startActivity(intent);

Reterive like this.

String data = getIntent().getExtras().getString("keyName");

Look here how to pass data using intents.

Comments