我正在尝试在活动之间传递数据
我使用意图在常规活动之间传递数据
考虑下面的代码::
AndroidTabRestaurantDescSearchListView.java
public class AndroidTabRestaurantDescSearchListView extends TabActivity {
// TabSpec Names
private static final String INBOX_SPEC = "Rating";
private static final String OUTBOX_SPEC = "Price";
Button Photos;
Button Filter;
Button Search;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
// Inbox Tab
TabSpec inboxSpec = tabHost.newTabSpec(INBOX_SPEC);
Intent inboxIntent = new Intent(this, RatingDescriptionSearchActivity.class);
inboxSpec.setIndicator(INBOX_SPEC);
// Tab Content
inboxSpec.setContent(inboxIntent);
// Outbox Tab
TabSpec PriceSpec = tabHost.newTabSpec(OUTBOX_SPEC);
Intent PriceIntent = new Intent(this, PriceDescriptionSearchActivity.class);
PriceSpec .setIndicator(OUTBOX_SPEC);
PriceSpec.setContent(PriceIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(inboxSpec);
tabHost.addTab(PriceSpec);
//Set the current value tab to default first tab
tabHost.setCurrentTab(0);
}
}
假设我从称为意图Activity-1
的其他活动发送数据AndroidTabRestaurantDescSearchListView
现在我怎样才能接收AndroidTabRestaurantDescSearchListView
我从中获取的数据Activity-1
,然后再将其传递给RatingDescriptionSearchActivity
图示为::
{EDIT} ——如果这可能基于答案——歧义,因为 AndroidTabRestaurantDescSearchListView 是一个选项卡活动
TabSpec inboxSpec = tabHost.newTabSpec(INBOX_SPEC);
Intent inboxIntent = new Intent(this, RatingDescriptionActivity.class);
intent.putExtra("keyName", value);
inboxSpec.setIndicator(INBOX_SPEC);
// Tab Content
inboxSpec.setContent(inboxIntent);