用getCacheDir()的时候报空指针异常
在java文件里写这句话的时候
private String path = getCacheDir().getPath();
说这句话抛出一个空指针异常
getCacheDir()方法不是获取Cache目录的吗
有大佬能给我讲一下吗...
private String path = getCacheDir().getPath();
说这句话抛出一个空指针异常
getCacheDir()方法不是获取Cache目录的吗
有大佬能给我讲一下吗...
...全文
相关推荐
henry_7getCacheDir
在Android开发中,`getCacheDir()` 是一个非常重要的方法,尤其对于管理和优化应用程序的内存使用至关重要。
Android开发中常用的一些小技巧
**TextUtils.isEmpty()**:这是一个方便的工具类,用于检查字符串是否为空或null,避免空指针异常,简化了空值检查的代码。3.
android getApplication()使用
**文件操作**: - 创建、读写文件时,`getApplication().getFilesDir()`或`getApplication().getCacheDir()`可以获取到应用的私有文件目录。
解决WebView通过URL加载H5界面出现空白的问题
(1024*1024*8);String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();webView.getSettings
android保存文件
保存的路径中项目文件下面:路径getFileDir() ----- /data/data/cn.xxx.xxx(当前包)/files getCacheDir(


