в случае, если вы просто хотите увеличить значение целого числа, просто сделайте это
String num = /*get the value from db*/;
int num1 = Integer.parseInt(num+"");
num = num1+"";
//then save the string num to the db.
но если вы хотите сохранить значение в устройстве, то предпочтительнее всего сохранить настройки.
private SharedPreferences pref;
pref = getApplicationContext().getSharedPreferences("valuestorage", 0); // 0 - for private mode
String num = /*get the value from db*/;
int num1 = Integer.parseInt(num+"");
num = num1+"";
pref.edit().putString("lastno",num).apply();
//then save the string num to the db.
теперь вам не нужно каждый раз вызывать базу данных, вызывайте ее, только если значение pref равно нулю.
так что теперь вы будете проверять значение из pref, увеличивать его и снова сохранять в db.
вот как:
с учетом данных в префе
String aa = pref.getString("lastno","");
if(!aa.equals(""))
{
String num = aa;
int num1 = Integer.parseInt(num+"");
num = num1+"";
pref.edit().putString("lastno",num).apply();
//then save the string num to the db.
}
https://developer.android.com/training/data-storage/shared-preferences