In Xamarin Android, I need to store some value in global variable which can be use through out the activities.
So how can i set and get the global variable?
In Xamarin Android, I need to store some value in global variable which can be use through out the activities.
So how can i set and get the global variable?
I think you could use SharedPreferences
.
For example, set data:
var data = GetSharedPreferences("Data", 0);
var editor = data.Edit();
editor.PutString("name","ABC");
editor.Commit();
And get data:
var data = GetSharedPreferences("Data", 0);
string name = data.GetString("name", "default");
And I think you could also try to use Application
and Resource
.