Java tutorial
//package com.java2s; import android.content.Context; import android.content.SharedPreferences; public class Main { public static final String FB_VARIABLES = "fbvariables"; private static final String FB_NAME = "name"; public static String getFbUsername(Context context) { SharedPreferences fbInfo = context.getSharedPreferences(FB_VARIABLES, 0); String username = fbInfo.getString(FB_NAME, ""); if (username.isEmpty()) { return ""; } return username; } }