For example, i have 3 activities.. I also use Tab host with separate activity when switch tab widget.
1) FoodTypeListActivity.class:there is a list of food type i.e. Breakfast, Dinner, Lunch..
2) MainTabActivity.class : Tabhost which has 3 tab widget
3) FoodListActivity.class : this activity is one of tab widget
I have a headlabel in layout of MainTabActivity.class which will show type of food as Textview from the previous activity(FoodTypeListActivity.class)
The problem is; i want to send the name of type of food from (FoodTypeListActivity.class) to set as headlabel in (MainTabActivity.class) and send id of food type (FoodTypeListActivity.class) to (FoodListActivity.class)
How do i implement putExtra to send data to different activity in on ListItem click of FoodTypeListActivity.class
Now i have the the following code in FoodTypeListActivity.class
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
if(position==0){
Intent i = new Intent(FoodTypeListActivity.this, MainTabActivity.class);
i.putExtra("foodTypeID", 3);
i.putExtra("foodTypeName", "Breakfast");
startActivity(i);
}
}
});
Thanks you
You should just use shared preference.
In your listview click use this to put the values in shared preference.
Now to pull the data out in ANY activity use..
I think this works well for what you are trying to do.