Android using variable for first time -
Android using variable for first time -      i need set values associated persistently stored data, if exist, on initialization. if not need initialize them. there disadvantage using sharedpreference initialize variable on first run. is, :    @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      sharedpreferences sp = getsharedpreferences("mydataname", context.mode_private);     string name = sp.getstring("name", "");     boolean isfirstrunning = sp.getboolean("firsttime", true);      if (isfirstrunning) {         toast.maketext(this, "yea", toast.length_long).show();          sharedpreferences.editor editor = sp.edit();         editor.putboolean("firsttime", false);         editor.commit();     }  }    if there no disadvantage processing level, there standard practice far situation concerned? also, there alternative way handle pe...