I have asynctask that gathers usernames, comments, and numbers. It places them into strings and is then suppose to call a BaseAdapter class, create an adapter, and set the a
Have you checked if the View
v that you return from your getView() method is null? Catching Exception
catches all exceptions. Not really helpful in my opinion. What's happening here is that you have not initiated Context ctx_invitation
. You should do this in the constructor. Now, since ctx_invitation
is null, it causes a NullPointerException
which is caught by the catch block. and View
v remains null.
Change the constructor for CreateCommentLists:
public CreateCommentLists(String[] comments, String[] usernames, String[] numbers, DashboardActivity context)
{
super();
listComments = comments;
listNumbers = usernames;
listUsernames = numbers;
ctx_invitation = context;
}
Change the following as well:
CreateCommentLists mycmlist = new CreateCommentLists(comments, usernames, numbers, DashboardActivity.this);
Googling around, looking at this question looks like you might be returning a null view from your adapter's getView method. Try tossing some breakpoints into the getView method and figure out where you are returning a null view.
Also, where are you storing the reference to the ctx_invitation in your BaseAdapter.
In the constructor you might want to pass that in
I hope this might be help,
onPostExecute include (Inside AsyncTask)
ExampleAdapter sectionedAdapter = new EfficientAdapter(ClassInfoThread.this,getBaseContext()); listView.setAdapter(sectionedAdapter);
and in your adapter class add this constructor
public ExampleAdapter(ExampleThread exampleThread,Context context) { mInflater = LayoutInflater.from(context); }
good luck.
Nandakishore P
Now ctx_invitation is never assigned a value. You probably need a constructor to assign value to ctx_invitation.