I want to do a midlet application for save product with its bar code, product's name, product's description and price. Then it is going to be saved as it:
123123123-coca cola-soda-6.50 124512341-crystal coca-soda-7.00
well for this I have built this code:
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;
}
}
I don't have an idea for how to create the method for find a product (with a part of its name, or with its bar code) and what is going to return? maybe an array?
For example all products has write coca in its name (or in description) or
find a unique product with bar code.
(This is a class with I'll instance for use its methods)