title: OnPostExecute item to ListView
body: <p>Here is OnPostExecute That  retuns Listitem [name1,name2,name3]:</p>
  
  <pre><code>@Override
      protected void onPostExecute(JSONObject json) {
          try {
  
              if (json.getString(KEY_SUCCESS) != null) {
                  String result = json.getString(KEY_SUCCESS);
                  if (Integer.parseInt(result) == 1) {
                      pDialog.setMessage("Loading View");
                      pDialog.setTitle("Getting Friends");
  
  
                      //JSONArray root = new JSONArray(json);
                      JSONArray friend = json.getJSONArray("users");
                      List&lt;String&gt; item = new ArrayList&lt;String&gt;();
  
                      for (int i = 0; i &lt; friend.length(); i++) {
                          JSONObject att = (JSONObject) friend.getJSONObject(i);
  
                          String res = att.getString("username");
                          item.add(res);
                      }
                      SharedPreferences FriendList = getSharedPreferences("FriendList", Context.MODE_PRIVATE);
                      SharedPreferences.Editor edit = FriendList.edit();
                      edit.putString("KEY_FRIENDS", item.toString());
                      edit.commit();
                  } else {
  
                      pDialog.dismiss();
  
                  }
  
              }else {
  
                  pDialog.dismiss();
  
              }
  
          } catch (JSONException e) {
              e.printStackTrace();
          }
  
          pDialog.dismiss();
  
  
      }
  </code></pre>
  
  <p>I want it In List View but im stucked, because i cant use ListAdapter in OnPostExecute.</p>
  
  <pre><code>public class FriendList extends ListActivity { ...    
  @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
     // setContentView(R.layout.activity_friend_list);
  
     // listt = (TextView) findViewById(R.id.testyL);
     // list = (TextView) findViewById(R.id.textView4);
     // list = (ListView) findViewById(R.id.label);
      try {
          new GetFriends().execute();
      }catch (Exception e) {
          e.printStackTrace() ;
          Log.e("ERR ", "AsyncTASK" + e.toString());
      }
      SharedPreferences FriendList = getSharedPreferences("FriendList", Context.MODE_PRIVATE);
      String u = FriendList.getString("KEY_FRIENDS", "0");
  </code></pre>
  
  <p>I tried to put item to SharedPref but it seems i dont know how to properly retrevie it and conter to variable that can be used by Array/List Adapter.
  Here is the problem :)</p>
  
  <pre><code>    // Binding resources Array to ListAdapter
      this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.label, item ));
  
  
      ListView lv = getListView();
  
      // listening to single list item on click
      lv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                  int position, long id) {
  
              // selected item
              String product = ((TextView) view).getText().toString();
  
              // Launching new Activity on selecting single List Item
              Intent i = new Intent(getApplicationContext(), Logged.class);
              // sending data to new activity
              i.putExtra("friend", product);
              startActivity(i);
  
          }
      });
  
  }
  </code></pre>