@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {

    super.onListItemClick(l, v, position, id);
    try {

      Intent i = new Intent(this, Messaging.class);
      JSONObject friend = friendAdapter.getItem(position);
      i.putExtra("friendObject", friend.toString());
      startActivity(i);

      Log.e("Friend Id", " " + friend.getString("id"));
      Log.e("Friend Display Name", " " + friend.getString("displayname"));
      Log.e("Friend Email", " " + friend.getString("email"));
      Log.e("Friend Status", " " + friend.getString("status"));
      Log.e("Friend Lattitude", " " + friend.getString("lattitude"));
      Log.e("Friend Longitude", " " + friend.getString("longitude"));
      Log.e("Friend Image", " " + friend.getString("imgstr"));

    } catch (JSONException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    /*Intent i = new Intent(this, Messaging.class);
    FriendInfo friend = friendAdapter.getItem(position);
    i.putExtra(FriendInfo.USERNAME, friend.userName);
    i.putExtra(FriendInfo.PORT, friend.port);
    i.putExtra(FriendInfo.IP, friend.ip);
    startActivity(i);*/
  }
  public void updateData(String friends, String unApprovedFriends) {
    if (friends != null) {
      try {
        friendObject = friends;
        friendAdapter.setFriendList(new JSONArray(friends));
        setListAdapter(friendAdapter);
      } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

    } else {
      setListAdapter(null);
    }
  }