• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to only initialise a variable on app first run

I use a class I call global0 with setter and getter and reset methods that use static variables that only change if you specify them to change you can access the data even between activities.


public int getVar0(){
return var00
}

public static int var00 = 6;//default value

public void setVar0(int var0){
var00 = var0;
}

public int getVar0(){
return var00;
}


public void reSetVar0(){
var00 = 6;//default value
}


//set variable
global0 global0 = new global0();
global0.setVar0(66);

//get variable
int getVar0 = global0.getVar0
 
Last edited:
Back
Top Bottom