做android 开发的话 判断app是否是第一次安装肯定是必须的 接下来给大家整一个
package com.example.mylibrary.utils;
/**
* @author LiHangZhou
* @description:
* @date :2020/12/25 9:48
* @love :zlx
*这是一个判断app是否是第一次安装的工具类
*/
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
public interface MySharedPreferences {
class SharedPreferencesUtil {
private static final String FILE_NAME = "Config";
private static SharedPreferences mPreferences;
private static SharedPreferences.Editor mEditor;
private static SharedPreferencesUtil mSharedPreferencesUtil;
@SuppressLint("CommitPrefEdits")
SharedPreferencesUtil(Context context) {
mPreferences = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
mEditor = mPreferences.edit();
}
public static SharedPreferencesUtil getInstance(Context context) {
if (mSharedPreferencesUtil ==