Ceci est un morceau d'un script qui doit reconnaître un texte de la caméra via TextRecognizer
puis rechercher un mot dans le texte. Si le mot est présent, le système doit enregistrer dans String found
le mot après.Impossible de résoudre la méthode pour SparseArray <TextBlock>
Le problème est que j'ai ces deux erreurs:
Cannot resolve method 'contains(java.lang.String)'
Cannot resolve method 'getValue(int)'
Comment puis-je résoudre cette erreur? Je n'ai trouvé aucune méthode similaire pour SparseArray<TextBlock>
.
public void receiveDetections(Detector.Detections<TextBlock> detections) {
String search = "palabra";
final SparseArray<TextBlock> items = detections.getDetectedItems(); //is the detection of textRecognizer of the camera
for (int i=0; i<items.size(); ++i)
{
if(items.get(i).contains(search))
{
String found = items.getValue(i+1);
Log.i("current lines ", found);
}
}
}