this.temperature=temperature;
this.pressure=pressure;
}
public void saveToDataBase ()
{
RecordStore recordStore;
DataOutputStream outputStream;
try {
recordStore = RecordStore.openRecordStore("locationPrefer", true);
} catch (RecordStoreException rsc) {
return;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
outputStream = new DataOutputStream(baos);
try {
outputStream.writeUTF(location);
outputStream.writeFloat(latitude);
outputStream.writeFloat(longitude);
outputStream.writeByte(timeZoneSrc);
outputStream.writeShort(timeZoneMin) ;
outputStream.writeBoolean(isDSTOn);
outputStream.writeShort(altitude);
outputStream.writeShort(temperature);
outputStream.writeShort(pressure);
byte[] bytes = baos.toByteArray();
if (recordStore.getNumRecords() == 0)
recordStore.addRecord(bytes, 0, bytes.length);
else
recordStore.setRecord(1, bytes, 0, bytes.length);
} catch (Exception exception) {
} finally {
try {outputStream.close();} catch (Exception ex) {}
try {recordStore.closeRecordStore();} catch (Exception ex) {}
}
}