0
我想爲節省產品的條形碼,產品名稱,產品說明和價格製作midlet應用程序。然後,它會被保存,因爲它:rms查詢,在文本中查找短語
123123123,可口可樂汽水,6.50 124512341晶可口可樂鈉7.00
以及爲了這個,我已經建立了這個代碼:
public boolean ProductoAgregar(String dato) // add product
{
byte bytes[] = dato.getBytes();
try {
rs.addRecord(bytes, 0, bytes.length);
return true;
} catch (RecordStoreException ex) {
ex.printStackTrace();
return false;
}
}
public boolean ProductoModificar(String dato, int id) // update product
{
try
{
byte bytes[] = dato.getBytes();
rs.setRecord(id, bytes, 0, dato.length());
return true;
}
catch(Exception ex)
{
return false;
}
}
public boolean ProductoEliminar(int id)// delete product
{
try
{
rs.deleteRecord(id);
return true;
}
catch(Exception ex)
{
return false;
}
}
對於如何創建查找產品的方法(使用其名稱的一部分或使用條形碼)以及返回什麼,我沒有想法。也許是一個數組?
例如,所有產品在其名稱(或描述中)中都寫有可口可樂或
找到帶條形碼的獨特產品。
(這是一個我將使用它的方法實例的類)