标签之间共享数据 [英] Sharing data between tabs
本文介绍了标签之间共享数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到了一些小问题,同时使一个选项卡功能的应用程序。
我想分享的数据,我的应用程序的两个选项卡之间。
我怎样才能达到同样的?
I am getting some glitches while making a tab enabled application.
I want to share data, between two tabs of my application.
How can I achieve the same?
RGDS 罗伯特·
推荐答案
正确的做法是设置一个静态字段为创建该选项卡中的活性
the correct way is setting a static field into the activity that creates the tabs
public class greformanews extends TabActivity {
public static String JorgesysTitle;
...
...
...
让你在活动选项卡中定义1
so in your Activity defined in tab 1
@Override
protected void onPause() {
greformanews.JorgesysTitle = "JORGESYS =)";
super.onPause();
}
在你的活动在标签中定义2
in your Activity defined in tab 2
//get value defined in Activity 1 !:)
String Title = greformanews.JorgesysTitle
这篇关于标签之间共享数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文