can we create or get exception when data is not saved in database using sugar orm

63 views Asked by At

I made an application where i will save data using sugar orm !! i have given the application to others and they complain that in very rare case the data doesn't gets saved in database !! so i want to know if its possible and if yes than how can i make the user to know that the data is not saved or simply how to handle it !!

Data data = new Data();


String datasn = getResources().getString(R.string.data_code);

costdisplay();

datasn = datasn + DateTime.now().toString("ddMMyyHHmmss");
datasn = datasn + vehicleNumber;
data.setsn(datasn);
data.sT(dataType);
data.setEvent(DateTime.now().toString("dd/MM/yyyy'T'HH:mm:ss.SSSZ"));
Log.e("data", DateTime.now().toString("dd/MM/yyyy'T'HH:mm:ss.SSSZ"));
data.setRNumber(vehicleNumber);
data.setIsSync(false);
data.setConsider(true);
data.setType(priceType);
data.setMessage(messageForPostpaid);
Log.e("log", data.getType());
data.setEventType(VehicleStatus.CHECKED_IN);
data.setCost(cost);
data.save();

Any help would be appreciated.

0

There are 0 answers