Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    private static final String DEFAULT_PREFERENCES_NAME = "HelpDeskPreferences";
    private static final String SHARED_PREFERENCE_NAME_HELPDESK_EMAIL = "baasio_helpdesk_email";
    private static SharedPreferences mPreferences;

    public static String getHelpDeskEmail(Context context) {
        SharedPreferences prefs = getPreference(context);
        String result = prefs.getString(SHARED_PREFERENCE_NAME_HELPDESK_EMAIL, "");

        return result;
    }

    private static SharedPreferences getPreference(Context context) {
        if (mPreferences == null)
            mPreferences = context.getSharedPreferences(DEFAULT_PREFERENCES_NAME, Context.MODE_PRIVATE);

        return mPreferences;
    }
}