java - Getting EditText value from ListView works... Sometimes -


Then I have a list view with a custom list in which it has an edit text. I put together a function which is called on request, which brings out a good list of all the values ​​of each edited texts. All cells are made from a stable list, and these are all exactly the same. The problem is, the first 7 cells work well with the code below , and then it crashes:

  ListView l = (ListView) CartPage.this FindViewById (R) .id.cartItems); // total_item_count int is equal to 11, which is how many cells are. For (int i = 0; i & lt; total_item_count-1; i ++) {View View = l.getChildAt (i); Println ("(" + I + "/" + total_item_count + ")"); Edit tagtext = (edit text) view.findViewById (R.id.product_count); String string = editText.getText (). ToString (); System.out.println (i + ":" + string); }   

This is my error log:

  02-17 06: 44: 17.540: E / Android Random (29086): Quite Exception: Main 02 - 17 06: 44: 17.540: E / Android Randomime (29086): java.lang.IllegalStateException: The method of activity could not be executed 02-17 06: 44: 17.540: E / AndroDenment (29086): On Android. $ ViewView $ 1 .onClick (see .Java 3617) 02-17 06: 44: 17.540: E / Android Random (29086): Android. View.View.performClick (see. Java 222) 02-17 06: 44: 17.540: E / Android Rendime (29086): For Android. View. Click Display $. See (java 17397) 02-17 06: 44: 17.540: E / Android Random (29086): Callback on Handheld Android (Handler Java: 725) 02-17 06: 44: 17.540: E / Android Time (29086): Android.OS Handler Dispatch Message (Handler. Java) 02-17 06: 44: 17.540: E / Android Time (29086): At android.os.Looper.loop (Looper.java:137) 02-17 06: 44: 17.540: E / Android Rendime (29086): Android. App ActivateTrade.Mine (ActivityTrad.Java TSI 167) 02-17 06: 44: 17.540: E / Android Random (29086): Kinetic (native methode) at java.lang.reflect.Method.invo 02-17 06: 44: 17.540 : E / Android Random (29086): at java.lang.reflect.Method.invoke (Method.Java T-1111) 02-17 06: 44: 17.540: E / AndroDreamtime (29086): com.android.internal.os .ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:793) 02-17 06: 44: 17.540: E / Android Time (29086): at com.android.internal.os. Zeigoteint.mine (Zeigoteinit.java image 60) 02-17 06: 44: 17.540: E / Android Random (29086): Dlvic. System NetStart.main (Basic method) 02-17 06: 44: 17.540: E / Android timeTime (29086): Reason by: java.lang.reflect.InvocationTargetException 02-17 06: 44: 17.540: E / AndroDerman (29086): at Java.lang.reflect.Method.invokeNative (basic method) 02-17 06:44: 17.540: E / Android Random (29086): at java.lang.reflect.Method.invoke (method Java 1111) 02-17 06 : 44: 17.540: E / Android Rendime (29086): For Android. View. See $ 1 .onClick (see. Java 3612) 02-17 06: 44: 17.540: E / Android Random (29086): ... 11 and 02-17 06: 44: 17.540: E / Androendime (29086): of Reason: Java .lang.NullPointerException 02-17 06:44:17 .540: E / Android Random (29086): at com.venuevip.android.CartPage.updateCart (CartPage.java.305) 02-17 06: 44: 17.540: E / Androordantum (29086): ... 14 more   

I tried to clean my project 10 times, there is no use.

Edit: It turns out that it only works for the number of items displayed on the screen when you flip it in the landscape and 3 items are shown, this is only for the first 3 Works.)

list view l = (list view) cart Page. this. Edit tagtext = (edit text) view.findViewById (R.id.product_count); String string; // total_item_count int is equal to 11, which is how many cells are. For (int i = 0; i & lt; total_item_count-1; i ++) {View View = l.getChildAt (i); Println ("(" + I + "/" + total_item_count + ")"); . String = editText.getText () toString (); System.out.println (i + ":" + string); }



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -