Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    public static final String USER_INFO = "user_info";
    public static final String USER_NAME = "user_name";

    public static String getUserName(Context context) {
        SharedPreferences preferences = context.getSharedPreferences(USER_INFO, Context.MODE_PRIVATE);
        String userIcon = preferences.getString(USER_NAME, "");
        return userIcon;
    }
}