android - How to get all edittext data from listview -


my listview have 19 rows , need edittext data listview , store arraylist.

 btn.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view view) {               int itemcount = mlistview.getcount();             log.d("count", ""+itemcount);             final arraylist<string> collection = new arraylist<>();             for(int i=0; i<itemcount; i++){                  view1 = mlistview.getchildat(i);                  log.d("position: ", ""+view1);                 edittext tt = (edittext)view1.findviewbyid(r.id.etqty);                 value = tt.gettext().tostring();                       collection.add(value);             }              //int position = contractstoreadapter.getitem();             log.d("number", string.valueof(collection));          }     }); 

here error.

09-07 08:09:05.526 8669-8669/com.example.chintatt.cbi e/androidruntime: fatal exception: main                                                                         process: com.example.chintatt.cbi, pid: 8669                                                                         java.lang.nullpointerexception: attempt invoke virtual method 'android.view.view android.view.view.findviewbyid(int)' on null object reference                                                                             @ com.example.chintatt.cbi.fragment_orderstock$1.onclick(fragment_orderstock.java:107)                                                                             @ android.view.view.performclick(view.java:5198)                                                                             @ android.view.view$performclick.run(view.java:21147)                                                                             @ android.os.handler.handlecallback(handler.java:739)                                                                             @ android.os.handler.dispatchmessage(handler.java:95)                                                                             @ android.os.looper.loop(looper.java:148)                                                                             @ android.app.activitythread.main(activitythread.java:5417)                                                                             @ java.lang.reflect.method.invoke(native method)                                                                             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726)                                                                             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) 

listview doesn't contain data, cause child view created every time comes display

you must have used adapter store data right? try info there. not listview adapter in data contains.

hope you

if u can tell how u storing data in adapter me further tell answer precisely


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -