当前位置:首页 > 青鸟知识 > android

Android自界说Sqlite数据库地位

来源:长沙北大青鸟新途 发布日期:2016-05-21
* @Title: changeDatabasesDir * @Des cription: TODO: Change default location of sqlite databases. * @param @param mContext * @return void * @throws public static void changeDatabasesDir(Context mContext) { try { Field field; field = ContextWrapper.class.getDeclaredField("mBase"); field.setAccessible(true); // 取得mBase变量 Object obj = field.get(mContext); field = obj.getClass().getDeclaredField("mDatabasesDir"); field.setAccessible(true); // 树立自界说途径 File file = new File(Path.DATABASES); field.set(obj, file); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block MyLog.e(e.toString()); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block MyLog.e(e.toString()); } catch (IllegalAccessException e) { // TODO Auto-generated catch block MyLog.e(e.toString()); }



拒绝套路 试听有礼

数据已加密保证您的信息安全