Programmers learn & share
0 votes
314 views

Problem :

I am new to java, I am trying to display this feed in Custom list view but when I am trying to do so I am getting the following error

 "Attempted to finish an input event but the input event receiver has already been disposed"

The above error is in logcat and nothing happens in app after that,i have an adpter class as follows:

public class MyUserAdapter extends ArrayAdapter<UserData>{

private Context context;

private List<UserData> users_list;

public MyUserAdapter(Context context, int resource,List<UserData> objects) {

super(context, resource);

this.context= context;

this.users_list= objects;

 }

@Override

public View getView(int position, View convertView, ViewGroup parent) {

LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View customview= inflater.inflate(R.layout.item_user, parent, false);

UserData userData=  users_list.get(position);

TextView tv = (TextView) customview.findViewById(R.id.textview1);

tv.setText(userData.getName());

return customview;

 }

}

 

LogCat:

hilz.myapplication W/EGL_emulation: eglSurfaceAttrib not implemented
hilz.myapplication W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa50c8260, error=EGL_SUCCESS
hilz.myapplication W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
by (7.5k points)   | 314 views

1 Answer

0 votes

Solution :

In your Public MyUserAdapter function, your super is not passing in the Objects.

It should be as follows:

public MyUserAdapter(Context context, int resource,List<UserData> objects)
{
super(context, resource, objects);
this.context= context;
this.users_list= objects;
}

and not like below:

public MyUserAdapter(Context context, int resource,List<UserData> objects)
{
super(context, resource);
this.context= context;
this.users_list= objects;
}
by (36.1k points)  
2,227 questions
2,734 answers
59 comments
241 users