Android Question add 1 to a value when an activity run

Ariyan Ahmadpour

New Member
Licensed User
hey.i want to add 1 to a value when an ativity start for example
B4X:
dim tst as int
tst = 1
Sub Activity_Pause (UserClosed As Boolean)
End Sub
i want to when Activity_Pause start,tst be + 1 and for next time,+1 too for ever
sorry for my bad english:oops:
 

KMatle

Expert
Licensed User
Longtime User
You need to store that variable to a file (See the file documentation how to write to a file).

In Activity_Pause save "tst" to a file (Pause = App is closed)

In Activity_Resume load "tst" from the file (check if the file exits) and add 1 to tst (tst=tst +1) (Resume = App (re)starts)

I recommend that you take a look at the beginners guide: https://www.b4x.com/android/forum/threads/b4a-beginners-guide.9578/#content
 
Upvote 0
Top