나는 결과에 영향을 미칠 것으로 생각되는 가장 중요한 비트로 줄이긴하지만 기본적으로 바이트에 관한 오류가있다. 이유는 모르겠지만이 코드는 다른 프로그램에서 작동하기 때문에 코드를 빌 렸습니다. 이것은 검색 버튼을 사용하여 레코드 저장소에서 데이터를 추출한 다음 업데이트 버튼을 사용하여 변경 한 경우 업데이트하지만 실행하도록 할 수는 없습니다.Java j2me의 RecordStore 업데이트 문제에 대한 도움이 필요하십니까?
도움이되는 업데이트 레코드 튜토리얼을 알려 주거나 도와 줄 수 있습니까?
감사
private RecordStore rs;
Update = new Form("Update");
Update.addCommand(new Command("Home", Command.BACK, 0));
cmRetrieve = new Command("Retrieve", Command.SCREEN, 1);
cmUpdate = new Command("Update", Command.SCREEN, 2);
tfRecID = new TextField("Record ID:", "", 8, TextField.NUMERIC);
txtName = new TextField("Name of Event: ", null, 15, TextField.ANY);
Update.append(tfRecID);
Update.append(txtName);
Update.addCommand(cmRetrieve);
Update.addCommand(cmUpdate);
Update.setCommandListener(this);
String str;
byte bytes[];
int recID;
else
if (c.getLabel().equals("Retrieve"))
{
recID = Integer.parseInt(tfRecID.getString());
bytes = rs.getRecord(recID);
str = new String(bytes);
int idx = str.indexOf(";");
txtName.setString(str.substring(0, idx));
}
else
if(c.getLabel().equals("Update"))
{
recID = Integer.parseInt(tfRecID.getString());
str = txtName.getString() + ":";
bytes = str.getBytes();
rs.setRecord(recID, bytes, 0, bytes.length);
}