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;

import android.util.Log;

public class Main {
    private static String facebookId;

    public static String getFacebookId(Context context) {
        if (facebookId != null)
            return facebookId;
        else {
            SharedPreferences prefs = context.getSharedPreferences("profilo", Context.MODE_PRIVATE);
            String id = prefs.getString("reg_id", "");
            if (id.isEmpty()) {
                Log.e("HELPER_FACEBOOK", "id facebook not found.");
                return null;
            } else {
                facebookId = id;
                return facebookId;
            }
        }
    }
}