android - Why my ListView inside a Fragment doesn't get updated? -


i have listview inside fragment:

public class editorfragment extends sherlockfragment {   private edittext editor = null;   private listview lv = null;   private edittext et = null;   private file root = null;   private string[] nomi={"test1","test2"};   private arrayadapter<string> aa;    @override   public view oncreateview(layoutinflater inflater, viewgroup parent,                                                  bundle savedinstancestate) {     sethasoptionsmenu(true);      view result = inflater.inflate(r.layout.editor, parent, false);      editor = (edittext) result.findviewbyid(r.id.editor);     lv = (listview) result.findviewbyid(r.id.list);     root = getactivity().getexternalfilesdir(null);     aa = new arrayadapter<string>(getactivity(), android.r.layout.simple_list_item_1, nomi );     lv.setadapter(aa);     return (result); } 

when user clicks button on actionbar following method gets called.

since contains notifydatasetchanged() expect listview refreshed, doesn't happen...

private file gettarget() {   int = 0;   if(et!=null)         filename=et.gettext().tostring();   if(root.list().length!=0) {         nomi= new string[(int) root.length()];         nomi=root.list();   };   aa.notifydatasetchanged();   return (new file(root,filename)); } 

thank help!


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -