Comments Listview in Android -


i have activity contains different items, 1 of item listview. created custom list adapter , sending json array. data list arrives server.

the list purpose make comments list. allowed user insert comment , show in listview. when have items in list works, , items shown. problem when listview empty , user post comment. see that data changed don't see item, means list not refreshed..

so tried add listview empty view doesn't work.

here updated code: (update)

       if (!s.isempty() && !s.equals("{}")) {              try {                 if (commentslistadapter == null) {                     commentslist.setemptyview(findviewbyid(r.id.dummy));                     commentslistadapter = new commentslistadapter(postview.this);                 }                 jsonobject resobj = new jsonobject(s);                 list.add(resobj);                  commentslistadapter.setdataset(list);                  cmnttxt.settext("");                 inputmanager.hidesoftinputfromwindow(getcurrentfocus().getwindowtoken(),                         inputmethodmanager.hide_not_always);                  commentcounter.settext(integer.tostring(list.size()));              } catch (jsonexception e) {                 e.printstacktrace();             }         } 

and inside adapter have function:

public void setdataset(list<jsonobject> list){     commentslist = list;     notifydatasetchanged(); } 

but problem not fixed..

i notice code list.add(resobj) appears after new commentslistadapter when list empty , appears before new commentslistadapter when list not empty.

i suspect adapter commentslistadapter not using object list data storage. in case, need make public method in adapter make updates. words, adapter using object data storage.

it may post code commentslistadapter also. hope correct statements. hope clear...


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -