What is the correct way to pass a simple variable which has its value set to use in another class? I have a counter which is incremented with a button press and when counter = 3 a method is called which loads another activity which loads another screen with a string which states the button was pressed. Here is where I want to include the number 3 passed from the counter variable in the previous class, but I am not sure the correct way to do this.
I tried creating an instance of the class and connecting to the variable that way but the value is never passed and it is always 0.
What is the correct way to pass a simple variable which has its value
Share
Try following code,