【发布时间】:2012-04-19 20:43:53
【问题描述】:
我要做的只是拥有一个可以从子选项卡访问的 JSONObject,以便我可以将信息放入其中。
public class Example extends TabActivity{
private JSONObject testtt = new JSONObject();
public void writeJSON(String key, String value) throws JSONException {
testtt.put(key, value);
}
public String getJSON(){
return testtt.toString();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.example);
//Creating the tabs and everything
//Is Here
}
}
我有下一个/上一个按钮,而不是来回导航标签 选项卡之一:
public void onClick(View v) {
//Pre-alertDialog.setmessage stuff here.
alertDialog.setMessage(Example.this.getJSON());
// Example.this gives this error: No enclosing instance of the type Example is accessible in scope
}
我已经尝试了很多替代的东西,并且已经到了寻求帮助的地步(对我来说非常罕见)。 很明显,我对 android 开发比较陌生。
编辑: 通过类扩展应用程序尝试全局变量时{
【问题讨论】:
-
我发现了我自己的问题...我正在向清单中添加一个
... 而我需要做的只是将名称添加到现有的 标记中。跨度>
标签: android json tabs arraylist android-tabhost