from the AsyncHttpResponseHandler documentation "All your processing should be handled in one of those 4 methods and then either call to run on UI thread a new runnable, or handle in onFinish which runs on the UI thread"
So setting the adapter in onFinish isn't the issue.
I'm not a fan of setting things to null then changing them later if you don't need to, so I made a change to your onCreate. Also, I suggest calling notifyDataSetChanged rather than setData. Give this a shot and let me know what happens.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contact_picker_main);
list = new ArrayList<FriendVO>();
mListView = (ListView) this.findViewById(R.id.listView1);
mFriendAdapter = new FriendAdapter(list);
mListView.setAdapter(mFriendAdapter);
}
@Override
public void onFinish(){
mFriendAdapter.notifyDataSetChanged();
mListView.setOnItemClickListener(itemClickListener);
}
Also, change this:
@Override
public int getCount() {
if (mData != null)
return mData.size();
else
return 0;
}
to this:
@Override
public int getCount() {
return mData.size();
}
You're mData should never be null (at worst, it'll be empty so size will be zero) and if it is, there's a problem you need to fix. This null check can only cause a problem to go unnoticed which you don't want.
And finally. Your adapter is set to allow any object to be passed as mData. Change your getItem from Object to FriendVO to give you better control and consistency.