Java Code Examples for android.app.Application#getFilesDir()
The following examples show how to use
android.app.Application#getFilesDir() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsLoaderUtil.java From MetroExample with Apache License 2.0 | 4 votes |
private static String getReactDir(Application application){ return application.getFilesDir()+ File.separator+jsState.reactDir+File.separator; }
Example 2
Source File: KernalBundle.java From atlas with Apache License 2.0 | 4 votes |
public static boolean checkLoadKernalDebugPatch(Application application) { if (Build.VERSION.SDK_INT < 21) { //暂时只支持art设备的debug调试 return false; } boolean loadKernalPatch = false; try { ApplicationInfo app_info = application.getApplicationInfo(); boolean debug = (app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; if (debug) { File debugBundleDir = new File(KernalConstants.baseContext.getExternalFilesDir("debug_storage"), KERNAL_BUNDLE_NAME); File patchFile = new File(debugBundleDir, "patch.zip"); if (patchFile.exists()) { loadKernalPatch = true; KernalBundle bundle = new KernalBundle(); //DexFile dexFile = (DexFile) KernalConstants.dexBooster.loadDex(KernalConstants.baseContext, KernalConstants.baseContext.getApplicationInfo().sourceDir, // new File(patchFile.getParent(), "base.dex").getAbsolutePath(), 0, true); File internalDebugBundleDir = new File(new File(application.getFilesDir(), "debug_storage"), KERNAL_BUNDLE_NAME); internalDebugBundleDir.mkdirs(); DexFile patchDexFile = (DexFile) DexFile.loadDex(patchFile.getAbsolutePath(),new File(internalDebugBundleDir, "patch.dex").getAbsolutePath(), 0); if (bundle.needReplaceClassLoader(application)) { NClassLoader loader = new NClassLoader(".", KernalBundle.class.getClassLoader().getParent()); try { NClassLoader.replacePathClassLoader(KernalConstants.baseContext, KernalBundle.class.getClassLoader(), loader); } catch (Exception e) { throw new RuntimeException(e); } } bundle.installKernalBundle(KernalConstants.baseContext.getClassLoader(), patchFile, new DexFile[]{patchDexFile/*, dexFile*/}, null, true /*(app_info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0*/); bundle.prepareRuntimeVariables(application); Class DelegateResourcesClazz = application.getClassLoader().loadClass("android.taobao.atlas.runtime.DelegateResources"); DelegateResourcesClazz.getDeclaredMethod("addApkpatchResources", String.class) .invoke(DelegateResourcesClazz, patchFile.getAbsolutePath()); Toast.makeText(KernalConstants.baseContext, "当前处于DEBUG调试状态,不支持动态更新,清除数据可恢复", Toast.LENGTH_LONG).show(); } } } finally { return loadKernalPatch; } }
Example 3
Source File: BookmarkPage.java From Xndroid with GNU General Public License v3.0 | 4 votes |
@NonNull public static File getBookmarkPage(@NonNull Application application, @Nullable String folder) { String prefix = !TextUtils.isEmpty(folder) ? folder + '-' : ""; return new File(application.getFilesDir(), prefix + FILENAME); }
Example 4
Source File: StartPage.java From Xndroid with GNU General Public License v3.0 | 4 votes |
@NonNull public static File getStartPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }
Example 5
Source File: DownloadsPage.java From Xndroid with GNU General Public License v3.0 | 4 votes |
@NonNull private static File getDownloadsPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }
Example 6
Source File: BookmarkPage.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
@NonNull public static File getBookmarkPage(@NonNull Application application, @Nullable String folder) { String prefix = !TextUtils.isEmpty(folder) ? folder + '-' : ""; return new File(application.getFilesDir(), prefix + FILENAME); }
Example 7
Source File: StartPage.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
@NonNull public static File getStartPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }
Example 8
Source File: DownloadsPage.java From JumpGo with Mozilla Public License 2.0 | 4 votes |
@NonNull private static File getDownloadsPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }
Example 9
Source File: FileUtils.java From Xndroid with GNU General Public License v3.0 | 3 votes |
/** * Use this method to delete the bundle with the specified name. * This is a blocking call and should be used within a worker * thread unless immediate deletion is necessary. * * @param app the application object needed to get the file. * @param name the name of the file. */ public static void deleteBundleInStorage(final @NonNull Application app, final @NonNull String name) { File outputFile = new File(app.getFilesDir(), name); if (outputFile.exists()) { outputFile.delete(); } }
Example 10
Source File: FileUtils.java From JumpGo with Mozilla Public License 2.0 | 3 votes |
/** * Use this method to delete the bundle with the specified name. * This is a blocking call and should be used within a worker * thread unless immediate deletion is necessary. * * @param app the application object needed to get the file. * @param name the name of the file. */ public static void deleteBundleInStorage(final @NonNull Application app, final @NonNull String name) { File outputFile = new File(app.getFilesDir(), name); if (outputFile.exists()) { outputFile.delete(); } }
Example 11
Source File: HistoryPage.java From Xndroid with GNU General Public License v3.0 | 2 votes |
/** * Get the file that the history page is stored in * or should be stored in. * * @param application the application used to access the file. * @return a valid file object, note that the file might not exist. */ @NonNull private static File getHistoryPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }
Example 12
Source File: HistoryPage.java From JumpGo with Mozilla Public License 2.0 | 2 votes |
/** * Get the file that the history page is stored in * or should be stored in. * * @param application the application used to access the file. * @return a valid file object, note that the file might not exist. */ @NonNull private static File getHistoryPageFile(@NonNull Application application) { return new File(application.getFilesDir(), FILENAME); }