All I am trying to do is have a JSONObject that can be accessible from children tabs, so that I can put info into it.
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
}
}
I have next/prev buttons than navigate the tabs back and forth one of the tabs:
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
}
I have tried a ton of alternative stuff, and have gotten to the point of asking for help (extremely rare for me). Its also probably obvious that I am relatively new to android development.
EDIT:
when attempting global variable via Class extends Application{