getJSONfromURL - Null Pointer Exception

view story

http://stackoverflow.com – I made an activity "Messages" which is supposed to get JSON data from a given URL. I tried making a loop to print the json data, but the problem was somewhere else. I am getting NullPointerException on the JSONArray, "json". Messages class: public class Messages extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = (TextView) findViewById(R.id.tv_messages); JSONArray json = JSONfunctions.getJSONfromURL("http://docs.blackberry.com/sampledata.json"); tv.setText(json.length()); } JSONfunctions cla (HowTos)