title: FATAL EXCEPTION: AsyncTask #2 java.lang.RuntimeException: An error occured while executing doInBackground()
body: <p>i m trying to call web services method from android app but i get in error java.lang.RuntimeException error occured while executing doInBackground() and the app stopped i have saw alot of question about this but they solved by adding internet permission to the manifest file but its Didn't work to</p>
  
  <p>here is my code</p>
  
  <pre><code>package com.yeftaandrea.plesirsolo;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  
  import org.apache.http.NameValuePair;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ListView;
  
  import com.yeftaandrea.plesirsolo.adapter.JsonAttractionAdapter;
  
  public class KaranganyarAttractionFragment extends Fragment {
  
      // URL to get contacts JSON
      // JSON Node names
      public static final String TAG_ID = "ID";
      public static final String TAG_NAME = "Name";
      public static final String TAG_ADDRESS = "Address";
      public static final String TAG_PHONE = "Phone";
      public static final String TAG_PICPATH = "PicPath";
  
      // Hashmap for ListView
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; attractionList;
      ListView list;
  
      JsonAttractionAdapter adapter;
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          View rootView = inflater.inflate(R.layout.fragment_attraction_karanganyar, container, false);
  
          list = (ListView) rootView.findViewById(R.id.list);
  
          list.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
                      long id) {
                  // TODO Auto-generated method stub
              }
              });
  
          // Calling async task to get json
          new LoadTask().execute();
  
          return rootView;
      }
  
      private void loadAttraction(){
          attractionList = new 
                  ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
          JSONParser parser = new JSONParser();
  
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
  
          try {
              JSONArray attraction = parser.makeHttpRequestArray("http://plesirsolo.meximas.com/plesir/attraction/wisata/getWisata/id/1", "GET", params);
              // JSONArray attraction = parser.makeHttpRequestArray("http://192.168.56.1:8080/examples/json.html", "GET", params);
              // looping through All messages
              for (int i = 0; i &lt; attraction.length(); i++) {
                  JSONObject c = attraction.getJSONObject(i);
  
                  // Storing each json item in variable
                  String id = c.getString(TAG_ID);
                  String nama = c.getString(TAG_NAME);
                  String address = c.getString(TAG_ADDRESS);
                  String phone = c.getString(TAG_PHONE);
                  String picPath = c.getString(TAG_PICPATH);
  
                  // creating new HashMap
                  HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
                  // adding each child node to HashMap key =&gt; value
                  map.put(TAG_ID, id);
                  map.put(TAG_NAME, nama);
                  map.put(TAG_ADDRESS, address);
                  map.put(TAG_PHONE, phone);
                  map.put(TAG_PICPATH, picPath);
  
                  // adding HashList to ArrayList
                  attractionList.add(map);
              }
  
              adapter = new JsonAttractionAdapter(
                      getActivity(), attractionList);
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
  
      private class LoadTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected Void doInBackground(Void... params) {
              loadAttraction();
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
              list.setAdapter(adapter);
              Log.i("JSON", "TEST");
              Log.i("JSON", attractionList.toString());
          }       
  
      }
  
  }
  </code></pre>
  
  <p>and the logcat</p>
  
  <pre><code>06-02 09:35:33.245: E/AndroidRuntime(1322): FATAL EXCEPTION: AsyncTask #2
  06-02 09:35:33.245: E/AndroidRuntime(1322): java.lang.RuntimeException: An error occured while executing doInBackground()
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.FutureTask.run(FutureTask.java:239)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.lang.Thread.run(Thread.java:841)
  06-02 09:35:33.245: E/AndroidRuntime(1322): Caused by: java.lang.NullPointerException
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at com.yeftaandrea.plesirsolo.KaranganyarAttractionFragment.loadAttraction(KaranganyarAttractionFragment.java:74)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at com.yeftaandrea.plesirsolo.KaranganyarAttractionFragment.access$0(KaranganyarAttractionFragment.java:63)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at com.yeftaandrea.plesirsolo.KaranganyarAttractionFragment$LoadTask.doInBackground(KaranganyarAttractionFragment.java:110)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at com.yeftaandrea.plesirsolo.KaranganyarAttractionFragment$LoadTask.doInBackground(KaranganyarAttractionFragment.java:1)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  06-02 09:35:33.245: E/AndroidRuntime(1322):     ... 4 more
  </code></pre>
  
  <p>I need your help, thank you</p>