When I debug the code, it is calling constructors in InviteListAdapter but it is not calling getView() method. I have tried multiple solutions available on stackoverflow but none of them works. Hope any one can find the mistake or solution for this.
invitableFriends.size()
returns value greater than 0.
InviteListAdapter
public class inviteListAdapter extends ArrayAdapter<JSONObject> {
private final Context context;
private final List<JSONObject> invitableFriends;
private ImageView profilePicView;
public inviteListAdapter(Context context, List<JSONObject> invitableFriends) {
super(context, R.layout.invite_adapter, invitableFriends);
this.context = context;
this.invitableFriends = invitableFriends;
}
@Override
public View getView(int position, View convertView, ViewGroup parent){
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(context.LAYOUT_INFLATER_SERVICE);
View listItemView = inflater.inflate(R.layout.invite_adapter, parent, false);
profilePicView = (ImageView) listItemView.findViewById(R.id.inviteListItemProfilePic);
TextView nameView = (TextView) listItemView.findViewById(R.id.inviteListItemName);
JSONObject currentUser = invitableFriends.get(position);
nameView.setText(currentUser.optString("first_name"));
return listItemView;
}
}
first.java
public View onCreateView (
LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_first,container, false);
invitesGridView = (GridView)view.findViewById(R.id.invitesGridView);
return view;
}
final inviteListAdapter adapter = new inviteListAdapter(this,inviteFriendList);
invitesGridView.setAdapter(adapter);
adapter.notifyDataSetChanged();