
③創(chuàng)建二維碼文件存儲(chǔ)目錄

private static String getFileRoot(Context context) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File external = context.getExternalFilesDir(null); if (external != null) { return external.getAbsolutePath(); } } return context.getFilesDir().getAbsolutePath(); }

④創(chuàng)建數(shù)據(jù)庫(kù)工具類來(lái)存儲(chǔ)臨時(shí)數(shù)據(jù)

public class SPUtil { private static final String CONFIG = "config"; /** * 獲取SharedPreferences實(shí)例對(duì)象 * * @param fileName */ private static SharedPreferences getSharedPreference(String fileName) { return QRCodeApplication.getInstance().getSharedPreferences(fileName, Context.MODE_PRIVATE); } /** * 保存一個(gè)String類型的值! */ public static void