Java tutorial
//package com.java2s; /** * Copyright (c) 2014 Microsoft Mobile and/or its subsidiary(-ies). * See the license text file delivered with this project for more information. */ import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class Main { private static final String PREFS_KEY_SENDER_ID = "sender_id"; /** * Stores the given sender ID. * * @param context The application context. * @param id The sender ID to store. * @return True if successful, false otherwise. */ public static boolean setSenderId(Context context, String id) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs.edit().putString(PREFS_KEY_SENDER_ID, id).commit(); } }