title: changing interface in an asynctask (the right way)
body: <p>I'm trying to change the process data retrieved into a list view. The data is recieved properly. but i'm failing to make up the list view the right way. </p>
  
  <p>Here is my asynctask class</p>
  
  <pre><code>class GetFriendsInfo extends AsyncTask&lt;String, String, String&gt;{
  
      String id = "";
      String fullName = "";
      String birthday = "";
  
      protected void onPreExecute() {
          super.onPreExecute();
          pd_GetData = new ProgressDialog(MainActivity.this);
          pd_GetData.setMessage("Getting friend data");
          pd_GetData.setIndeterminate(false);
          pd_GetData.setCancelable(true);
          pd_GetData.show();
      }
  
      @Override
      protected String doInBackground(String... params) {
  
          JSONArray friendArray;
  
          List&lt;NameValuePair&gt; param = new ArrayList&lt;NameValuePair&gt;();
          param.add(new BasicNameValuePair("user_id", id));
          param.add(new BasicNameValuePair("user_id", fullName));
          param.add(new BasicNameValuePair("user_id", birthday));
  
          JSONObject jsonObject = jsonParser.makeHttpRequest(url_get_birthdays,"GET", param);
  
          try{
              int success = jsonObject.getInt(TAG_SUCCESS);
  
              if (success == 1){
                  Log.d("PHP Server [GET]", "Retrieved user data");
  
                  String jsonString = jsonObject.getString("message");
                  friendArray = new JSONArray(jsonString);
  
                  String[] names = new String[friendArray.length()];
                  String[] birthdays = new String[friendArray.length()];
                  String[] ids = new String[friendArray.length()];
  
                  for(int i=0; i&lt;friendArray.length(); i++) {
                      JSONObject friend = friendArray.getJSONObject(i);
                      String friend_id = friend.getString("id");
                      ids[i] = friend_id;
                      String friend_name = friend.getString("fullName");
                      names[i] = friend_name;
                      String friend_birthday = friend.getString("birthday");
                      birthdays[i] = friend_birthday;
                  }
  
                  Log.i("friend:", Arrays.toString(ids) + " " + Arrays.toString(names) + " " + Arrays.toString(birthdays));
  
                 List&lt;HashMap&lt;String, String&gt;&gt; birthday = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
                  for (int i=0;i&lt;names.length;i++){
                      HashMap&lt;String, String&gt; hm = new HashMap&lt;String, String&gt;();
                      hm.put("names", names[i]);
                      hm.put("ids", ids[i]);
                      hm.put("birthdays", birthdays[i]);
                      birthday.add(hm);
                  }
  
                  String[] from = {"names", "ids", "birthdays"};
                  int[] to = {R.id.text1, R.id.im_ProfilePic, R.id.text2};
  
                  SimpleAdapter adapter = new SimpleAdapter(MainActivity.this, birthday, R.layout.listitem_birthday, from, to);
                  HorizontalListView featuredList = (HorizontalListView) findViewById(R.id.lv_Birthdays);
                  featuredList.setAdapter(adapter);
  
              }else{
                  Log.d("PHP Server [GET]", "Failed retrieve user data");
              }
          }catch (JSONException e){
              e.printStackTrace();
          }catch (RuntimeException e){
              e.printStackTrace();
          }
  
          return null;
      }
  
      protected void onPostExecute(JSONArray result) {
          // dismiss the dialog once done
  
  
          pd_GetData.dismiss();
      }
  }
  </code></pre>
  
  <p>I know that i shouldn't create the listview in the doInBackground. But i don't have a clue how i should do it.</p>