Olá pessoal, ainda não entendo muito bem Java para dispositivos móveis, então queria uma mãozinha em algo que deve ser simples. 
Tenho uma aplicação armazenando senhas em um arquivo RMS. Se a senha não existir ele armazena no arquivo normalmente, agora, se a senha já existir, deve-se validar (sem a necessidade de armazená-la novamente) e passar para a próxima tela. Essa validação não estou conseguindo fazer por “vias normais” ou “for, if” etc … existe algum método que faria isso mais fácil? Só preciso comparar a string digitada varrendo todas as entradas armazenadas no RMS.
Aqui vai um pequeno pedaço de código onde eu faço o “try” da gravação da senha no RMS:
try{
rs = RecordStore.openRecordStore(STORE_NAME, true);
senha=txtPass.getString();
// Create a byte stream we can write to
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
// To make life easier use a DataOutputStream to write the bytes
// to the byteStream (ie. we get the writeXXX methods)
DataOutputStream dataOutputStream = new DataOutputStream(byteOutputStream);
dataOutputStream.writeUTF(senha);
// ... add other dataOutputStream.writeXXX statements if you like
dataOutputStream.flush();
// add the record
byte[] recordOut = byteOutputStream.toByteArray();
int newRecordId = rs.addRecord(recordOut, 0, recordOut.length);
System.out.println("Adicionando nova gravação: " + newRecordId +
" Valor: " + recordOut.toString());
dataOutputStream.close();
byteOutputStream.close();
// retrieve the state of the store now that it's been populated
System.out.println("Armazenado " + rs.getNumRecords() +
" entrada(s) usando " + rs.getSize() + " byte(s) " +
"[" + rs.getSizeAvailable() + " bytes livres]");
for (int i=1; i <= rs.getNumRecords(); i++){
int recordSize = rs.getRecordSize(i);
if (recordSize > 0){
// construct a byte and wrapping data stream to read back the
// java types from the binary format
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(rs.getRecord(i));
DataInputStream dataInputStream = new DataInputStream(byteInputStream);
String value = dataInputStream.readUTF();
// ... add other dataOutputStream.readXXX statements here matching the
// order they were written above
System.out.println("Obtida entrada: " + i + " Valor: " + value);
dataInputStream.close();
byteInputStream.close();
}
}
}
catch(Exception e){
e.printStackTrace();
}
=============================
Se alguém puder ajudar, ficaria muito grata =)
Obrigada.