android - Retrieving information from sqlite cursor -


i've make function search in db cursor column value. send string values search , function returns positions of rows have values. well, suppose work way. when run error in logcat:

java.lang.arrayindexoutofboundsexception: lenght=3; index=3

here function:

public string buscareceita(cursor c, string[] o) {       string info = "";     int f=0;     string pos= "";             int totalpos = c.getcount();      for(int y=0;y<totalpos;y++){         (string buscar : o) {             c.movetoposition(y);             info = c.getstring(c.getcolumnindex("idingredientes"));             string b[] = info.split("\\.");              for(int i=0; <= b.length; i++){                 if (b[i]==buscar){                     f++;                 }             }         }         if (f>=3) {             pos+=c.getstring(c.getposition())+".";                      }                 }     return pos;  } 

in column "idingredientes" have formatted string like: 2.5.17. (this ids want). function suppose return ids if match minimal of 3 values.

sorry poor english guys, i'm brazil. grateful help!


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -