android - Cannot resolve method for SparseArray<TextBlock> -


this piece of script has recognize text camera through textrecognizer , search word inside text. if word present, system has save in string found word after.

the problem have 2 errors:

cannot resolve method 'contains(java.lang.string)' cannot resolve method 'getvalue(int)' 

how can solve errors? haven't found similar method sparsearray<textblock>.

public void receivedetections(detector.detections<textblock> detections) {    string search = "palabra";   final sparsearray<textblock> items = detections.getdetecteditems(); //is detection of textrecognizer of camera    (int i=0; i<items.size(); ++i)    {     if(items.get(i).contains(search))      {        string found = items.getvalue(i+1);        log.i("current lines ", found);     }   }  } 

you can find sparsearray documentation here.

as can see, there no getvalue() method on sparsearray, calling getvalue(int) on sparsearray items variable not valid.

similarly, textblock doesn't have contains(string) method. calling items.get(i) return textblock, attempting call contains(string) on textblock invalid.

based on see in code, i'm guessing looking more this, calls string's contains() method:

for (int i=0; i<items.size(); ++i) {]     textblock text = items.get(i)      // textblock's value string     string value = text.getvalue()      // check if text block contains search string     if(value.contains(search)) {         string found = items.getvalue(i+1);         log.i("found search string " + search + " in block " + value);     } } 

Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -