this method i'm getting java.lang.indexoutofboundsexception
error. when debug code , see, getting
tempkoradel[j] = java.lang.indexoutofboundsexception : invalid array range: 5 5 columntags[j] = java.lang.indexoutofboundsexception : invalid array range: 5 5.
try { soapobject request = new soapobject(namespace, "getassigndetails"); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); // request.addproperty("barcode",params[0]); httptransportse androidhttptransport = new httptransportse(url); try { androidhttptransport.call(namespace + "getassigndetails", envelope); } catch (ioexception | xmlpullparserexception e) { // todo auto-generated catch block e.printstacktrace(); } soapprimitive response; string koradcdetailss = null; try { response = (soapprimitive) envelope.getresponse(); koradcdetailss = response.tostring(); if (koradcdetailss != null) { string[] columntags = new string[]{"styleno", "color", "size", "barcodeno", "noofpcs"}; int[] columnids = new int[]{r.id.txt_styleno, r.id.txt_color, r.id.txt_size, r.id.txt_barcodeno, r.id.txt_pcs}; string[] koradcdeldetails = koradcdetailss.split(":,"); if (koradcdeldetails.length > 0) { list = new arraylist<hashmap<string, string>>(); (int = 0; < koradcdeldetails.length; i++) { if (!koradcdeldetails[i].isempty()) { string[] tempkoradel = koradcdeldetails[i].split(";"); hashmap<string, string> map = new hashmap<string, string>(); //initialize row data (int j = 0; j < (columntags.length); j++) { map.put(columntags[j], tempkoradel[j]); } list.add(map); } } listhdr = new arraylist<hashmap<string, string>>(); hashmap<string, string> map = new hashmap<string, string>(); //initialize row data (int j = 0; j < columntags.length; j++) { map.put(columntags[j], columntags[j]); } listhdr.add(map); simpleadapter arrayadapterhdr = new simpleadapter(rfidscanningactivity.this, listhdr, r.layout.rfid_scanning_row, columntags, columnids); listviewhdr.setadapter(arrayadapterhdr); simpleadapter arrayadapter = new simpleadapter(rfidscanningactivity.this, list, r.layout.rfid_scanning_row, columntags, columnids); listview.setadapter(arrayadapter); } } else { //helper.infomsg("info", "no stock found", this); } } catch (exception e) { //helper.infomsg("info", "no stock found1", this); } } catch (exception er) { //helper.warning("error", "error 2" + er.tostring(), this); } return null; }
please me out clear above error.
list = new arraylist<hashmap<string, string>>(); (int = 0; < koradcdeldetails.length; i++) { if (!koradcdeldetails[i].isempty()) { string[] tempkoradel = koradcdeldetails[i].split(";"); hashmap<string, string> map = new hashmap<string, string>(); //initialize row data (int j = 0; j < (tempkoradel.length); j++) { map.put(columntags[j], tempkoradel[j]); } list.add(map); }
you indexoutofboundsexception when have 3 values in array , try access forth element doesn't exists. need careful when handle array.
Comments
Post a Comment