Why the data retrieved isn't shown <p>I would to retrieve the data from <a href="http://api.eventful.com/rest/events/search?app_key=42t54cX7RbrDFczc&amp;location=singapore" rel="nofollow">http://api.eventful.com/rest/events/search?app_key=42t54cX7RbrDFczc&amp;location=singapore</a> . The tag under "title", "start_time", "longitude", "latitude". But I not sure why it couldn't be display out after I added the longitude and latitude.</p> <p>This is from logcat: </p> <pre><code>08-07 17:17:44.190: E/AndroidRuntime(23734): FATAL EXCEPTION: main 08-07 17:17:44.190: E/AndroidRuntime(23734): java.lang.NullPointerException 08-07 17:17:44.190: E/AndroidRuntime(23734): at com.example.eventfulmaptry.MainActivity$ItemAdapter.getView(MainActivity.java:147) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.AbsListView.obtainView(AbsListView.java:1618) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.ListView.measureHeightOfChildren(ListView.java:1241) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.ListView.onMeasure(ListView.java:1152) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.View.measure(View.java:8513) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3143) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.LinearLayout.measureVertical(LinearLayout.java:386) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.View.measure(View.java:8513) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3143) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.View.measure(View.java:8513) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.LinearLayout.measureVertical(LinearLayout.java:531) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.View.measure(View.java:8513) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3143) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.widget.FrameLayout.onMeasure(FrameLayout.java:250) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.View.measure(View.java:8513) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.ViewRoot.performTraversals(ViewRoot.java:857) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.view.ViewRoot.handleMessage(ViewRoot.java:1878) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.os.Looper.loop(Looper.java:130) 08-07 17:17:44.190: E/AndroidRuntime(23734): at android.app.ActivityThread.main(ActivityThread.java:3691) 08-07 17:17:44.190: E/AndroidRuntime(23734): at java.lang.reflect.Method.invokeNative(Native Method) 08-07 17:17:44.190: E/AndroidRuntime(23734): at java.lang.reflect.Method.invoke(Method.java:507) 08-07 17:17:44.190: E/AndroidRuntime(23734): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) 08-07 17:17:44.190: E/AndroidRuntime(23734): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670) 08-07 17:17:44.190: E/AndroidRuntime(23734): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>This is my code :</p> <pre><code>public class MainActivity extends Activity { ArrayList&lt;String&gt; title; ArrayList&lt;String&gt; start_time; ArrayList&lt;String&gt; latitude; ArrayList&lt;String&gt; longitude; ItemAdapter adapter1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ListView list = (ListView) findViewById(R.id.list); title = new ArrayList&lt;String&gt;(); latitude = new ArrayList&lt;String&gt;(); longitude = new ArrayList&lt;String&gt;(); try { URL url = new URL( "http://api.eventful.com/rest/events/search?app_key=42t54cX7RbrDFczc&amp;location=singapore"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("event"); for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); Element fstElmnt = (Element) node; NodeList nameList = fstElmnt.getElementsByTagName("title"); Element nameElement = (Element) nameList.item(0); nameList = nameElement.getChildNodes(); title.add(""+ ((Node) nameList.item(0)).getNodeValue()); NodeList websiteList = fstElmnt.getElementsByTagName("start_time"); Element websiteElement = (Element) websiteList.item(0); websiteList = websiteElement.getChildNodes(); start_time.add(""+ ((Node) websiteList.item(0)).getNodeValue()); NodeList websiteList1 = fstElmnt.getElementsByTagName("latitude"); Element websiteElement1 = (Element) websiteList1.item(0); websiteList1 = websiteElement1.getChildNodes(); latitude.add(""+ ((Node) websiteList1.item(0)).getNodeValue()); NodeList websiteList2 = fstElmnt.getElementsByTagName("longitude"); Element websiteElement2 = (Element) websiteList2.item(0); websiteList2 = websiteElement2.getChildNodes(); longitude.add(""+ ((Node) websiteList2.item(0)).getNodeValue()); } } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } adapter1 = new ItemAdapter(this); list.setAdapter(adapter1); } class ItemAdapter extends BaseAdapter { final LayoutInflater mInflater; private class ViewHolder { public TextView title_text; public TextView des_text; public TextView lat_text; public TextView long_text; } public ItemAdapter(Context context) { // TODO Auto-generated constructor stub super(); mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } //@Override public int getCount() { return title.size(); } //@Override public Object getItem(int position) { return position; } //@Override public long getItemId(int position) { return position; } //@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; final ViewHolder holder; if (convertView == null) { view = mInflater.inflate(R.layout.mainpage_list,parent, false); holder = new ViewHolder(); holder.title_text = (TextView) view.findViewById(R.id.title_text); holder.des_text = (TextView) view.findViewById(R.id.des_text); holder.lat_text = (TextView) view.findViewById(R.id.lat_text); holder.long_text = (TextView) view.findViewById(R.id.long_text); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } holder.title_text.setText(""+title.get(position)); holder.des_text.setText(""+Html.fromHtml(start_time.get(position))); holder.lat_text.setText(""+Html.fromHtml(latitude.get(position))); holder.long_text.setText(""+Html.fromHtml(longitude.get(position))); return view; } } } </code></pre>