java - how can i create an arrayadapter in asynctask. onPostExecute -
protected void onpostexecute(string s) { veriadaptoru=new arrayadapter<string> (this, android.r.layout.simple_list_item_1, android.r.id.text1, a); liste=(listview)findviewbyid(r.id.listview1); liste.setadapter(veriadaptoru); } i have write code in part error
(veriadaptoru=new arrayadapter<string> (this, android.r.layout.simple_list_item_1, android.r.id.text1, a);)
the problem in new arrayadapter<string> (this, android.r.layout.simple_list_item_1, android.r.id.text1, a); must load context activity, if write this in onpostexecute another. make in activity class variable
context context = myactivity.this; if asynctask in class - create constructor , pass context activiy in it. , can do
(context, android.r.layout.simple_list_item_1, android.r.id.text1, a);`
Comments
Post a Comment