Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For Login screen tasks like storing username and password you can use Shared Preferences. Here I had made custom methods for using shared preferences. Call <code>savePreferences()</code> method and put your Key and Value(as <code>savePreferences()</code> is based on XML), similarly call Load with your Key. And lastly don't forgot to call <code>deletePreferences()</code> on LOGOUT. </p> <pre><code>/** * Method used to get Shared Preferences */ public SharedPreferences getPreferences() { return getSharedPreferences(&lt;PREFRENCE_FILE_NAME&gt;, MODE_PRIVATE); } /** * Method used to save Preferences */ public void savePreferences(String key, String value) { SharedPreferences sharedPreferences = getPreferences(); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); } /** * Method used to load Preferences */ public String loadPreferences(String key) { try { SharedPreferences sharedPreferences = getPreferences(); String strSavedMemo = sharedPreferences.getString(key, ""); return strSavedMemo; } catch (NullPointerException nullPointerException) { Log.e("Error caused at TelaSketchUtin loadPreferences method", "&gt;======&gt;" + nullPointerException); return null; } } /** * Method used to delete Preferences */ public boolean deletePreferences(String key) { SharedPreferences.Editor editor=getPreferences().edit(); editor.remove(key).commit(); return false; } </code></pre> <p>Hope this should help you. Don't Forget to do +1.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload