android - How can I convert a string with integers to array with integers in java? -


i want convert string integers array integers in java. how can this?i have array strings.every string integers. want access every string click button.

 string[] int_array={          //0         "250,125,20,20,20,40,20,20,20,40,20,20,20,2500",          //1          "233,63,28,63,29,63,28,16,28,17,26,63,29,17,26,16....                      ........                   }     public void onclick(view v) {          counter++;         string intstring = int_array[counter];                      string[] parts = intstring.split(",");             final int[] = new int[parts.length()];            for(int i=0; i<parts.length(); i++){              a[i] = integer.parseint(parts(i));                              toast.maketext(getapplicationcontext(),string.valueof(a[i]), toast.length_short).show();          }    } 

private integer[] splitintegers(string s){         object[] numbersasstring = s.split(",");         return arrays.copyof(numbersasstring, numbersasstring.length, integer[].class); } 

calling:

for(string s: int_array){   integer[] ints = splitintegers(s); } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -