1

NullPointerException on JSONArray initialized in background thread

view story
linux-howto

http://stackoverflow.com – I'm writing an android app I use a background thread to pull a JSONArray from a web service. I then need to interact with that JSONArray inside the main activity. Here's what I'm doing now: public class MainActivity extends Activity { JSONArray stories; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new getAll().execute(); // try { System.out.println("stories.length()); // } catch (JSONException e) { // TODO Auto-generated catch block // e.printStackTrace(); (HowTos)