ListView has not been created yet, so it has no children. Unfortunately, there is no callback such as onResume() when the View was created, but you can use Runnable to do what you want.
Adding
Make a couple of changes to onCreate() :
listView.setAdapter(couponsListAdapter); // Remove your calls to notifyDataSetChanged and setFbUsersImage // Add this Runnable listView.post(new Runnable() { @Override public void run() { setFbUsersImage(listView,fbUserArrayList); } });
You need to make listView field variable just like fbUserArrayList . Now setFbUsersImage() will be fired if the ListView has children.
All that said, if you are trying to modify the string in any way, the adapter is best for this.
source share