title: MainActivity not populated with data from listview
body: <p>I am trying to populate my listview from this <a href="http://dailymed.nlm.nih.gov/dailymed/services/v2/drugclasses.json" rel="nofollow">API</a>.</p>
  
  <p>There are no errors when I compile and run the app, but there is just a blank MainActivity. Here is my code for my project.</p>
  
  <p>Main Activity: </p>
  
  <pre><code>package com.example.szen95.meddict;
  
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.view.MenuItem;
  
  
  public class MainActivity extends ActionBarActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          if (savedInstanceState == null) {
              getSupportFragmentManager().beginTransaction()
                      .add(R.id.container, new SearchFragment())
                      .commit();
          }
          getSupportActionBar().setElevation(0f);
       }
  
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
  
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>SearchFragment:</p>
  
  <pre><code>package com.example.szen95.meddict;
  
  /**
   * Created by szen95 on 6/15/15.
   */
  
  import android.app.ProgressDialog;
  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.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.SimpleAdapter;
  
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  /**
   * A placeholder fragment containing a simple view.
   */
  public class SearchFragment extends Fragment {
  
      private ProgressDialog pDialog;
  
      // URL to get contacts JSON
      private static String url = "http://dailymed.nlm.nih.gov/dailymed/services/v2/drugclasses.json";
  
      // JSON Node names
      private static final String TAG_DATA = "data";
      private static final String TAG_CODE = "code";
      private static final String TAG_CODING_SYSTEM = "codingSystem";
      private static final String TAG_TYPE = "type";
      private static final String TAG_NAME = "name";
  
  
      // contacts JSONArray
      JSONArray data = null;
  //    ArrayAdapter&lt;String&gt; mConditionsAdapter;
  
      public SearchFragment() {
      }
  
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; dataList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      public View onCreateView(LayoutInflater inflater,
                               ViewGroup container,
                               Bundle savedInstanceState) {
  
          // Retrieving the currently selected item number
  //        int position = getArguments().getInt("position");
  
          // Creating view correspoding to the fragment
          View v = inflater.inflate(R.layout.fragment_main, container, false);
  
          new GetData().execute();
  
          return v;
      }
  
      /**
       * Async task class to get json by making HTTP call
       * */
      private class GetData extends AsyncTask&lt;Void, Void, Void&gt; {
  
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              // Showing progress dialog
              pDialog = new ProgressDialog(getActivity());
              //
              pDialog.setMessage("Please wait...");
              pDialog.setCancelable(false);
              pDialog.show();
  
          }
          @Override
          protected Void doInBackground(Void... arg0) {
              // Creating service handler class instance
              ServiceHandler sh = new ServiceHandler();
  
              // Making a request to url and getting response
              String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
  
              Log.d("Response: ", "&gt; " + jsonStr);
  
              if (jsonStr != null) {
                  try {
                      JSONObject jsonObj = new JSONObject(jsonStr);
  
                      // Getting JSON Array node
                      data = jsonObj.getJSONArray(TAG_DATA);
  
                      // looping through All Contacts
                      for (int i = 0; i &lt; data.length(); i++) {
                          JSONObject c = data.getJSONObject(i);
  
                          String code = c.getString(TAG_CODE);
                          String codingSystem = c.getString(TAG_CODING_SYSTEM);
                          String type = c.getString(TAG_TYPE);
                          String name = c.getString(TAG_NAME);
  
  
                          // tmp hashmap for single contact
                          HashMap&lt;String, String&gt; data = new HashMap&lt;String, String&gt;();
  
                          // adding each child node to HashMap key =&gt; value
                          data.put(TAG_CODE, code);
                          data.put(TAG_CODING_SYSTEM, codingSystem);
                          data.put(TAG_TYPE, type);
                          data.put(TAG_NAME, name);
  
                          // adding contact to contact list
                          dataList.add(data);
                      }
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              } else {
                  Log.e("ServiceHandler", "Couldn't get any data from the url");
              }
  
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
              // Dismiss the progress dialog
              if (pDialog.isShowing())
                  pDialog.dismiss();
              /**
               * Updating parsed JSON data into ListView
               * */
              SimpleAdapter adapter = new SimpleAdapter(getActivity(), dataList,
                      R.layout.list_item_search, new String[] { TAG_NAME, TAG_CODE}, new int[] { R.id.name,
                      R.id.code});
  
              setListAdapter(adapter);
          }
  
      }
  
      private void setListAdapter(SimpleAdapter adapter) {
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
          setHasOptionsMenu(true);
      }
  
      @Override
      public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
          inflater.inflate(R.menu.menu_main, menu);
  
  
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          int id = item.getItemId();
          if (id == R.id.action_refresh) {
  //            FetchDataTask defTask = new FetchDataTask();
  //            defTask.execute();
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>