是否可以将意图传递给选项卡?
我尝试将意图传递给操作栏选项卡。 我有一个构建 ActionBar 的主要活动:
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
Tab tab = actionBar.newTab()
.setText("MY TICKETS")
.setTabListener(new TabListener<ShowListFragment>(
this, "LISTVIEW", ShowListFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText("LAST DRAW")
.setTabListener(new TabListener<ShowLastDrawFragment>(
this, "SHOWVIEW", ShowLastDrawFragment.class));
actionBar.addTab(tab);
现在我想通过意图机制传递一些信息,这可能吗? 就像:
intent.putExtra("intent", mySerializeable());
我想通过以下方式访问我的选项卡片段中的类:
mySerializeable ms = (mySerializeable) getIntent().getSerializableExtra("intent");
我发现了类似 setContent(Intent Intent) 的内容,但这仅适用于 TabHost。 我想做的事情通常可能吗?如果是的话,如何做?
I try to pass an intent to an action bar tab.
I have a main activity where I build my ActionBar:
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
Tab tab = actionBar.newTab()
.setText("MY TICKETS")
.setTabListener(new TabListener<ShowListFragment>(
this, "LISTVIEW", ShowListFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText("LAST DRAW")
.setTabListener(new TabListener<ShowLastDrawFragment>(
this, "SHOWVIEW", ShowLastDrawFragment.class));
actionBar.addTab(tab);
Now I want to pass some informations with the intent mechanism, is this possible?
Like:
intent.putExtra("intent", mySerializeable());
I would like to access the class inside my tab fragment with:
mySerializeable ms = (mySerializeable) getIntent().getSerializableExtra("intent");
I found something like setContent(Intent intent), but that only works with TabHost.
Is it generally possible what I am trying to do and when yes, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论