0

I want to increase the textvalue automatic when the activity was reopen

for eq

when we order some food we got a order id which diffrent from pervious id

I want to do this in my project so any one help me

1 Answers1

1

Store value in SahredPrefrance and access or update when you order like following,

SharedPreferences prefs=getSharedPreferences("order_detail", MODE_PRIVATE);
        int old_amount=prefs.getInt("order_amount",0); // initial it return zero
        int new_amount=old_amount+currnt_amount;
        prefs.edit().putInt("order_amount",new_amount).commit();
Dhaval Solanki
  • 4,589
  • 1
  • 23
  • 39
  • Use a global variable concept to store the value and get it back...you can follow this example to get it done http://stackoverflow.com/questions/1944656/android-global-variable – Saurabh Apr 20 '16 at 12:03