- 博客(5)
- 收藏
- 关注
原创 Android 通过反射机制获取StorageVolume中的 getPathFile()方法
首先定义了一个静态方法 getPathFile(),接受一个 StorageVolume 对象作为参数,并返回一个 File 对象。在方法内部,通过 Class.forName() 方法获取 android.os.storage.StorageVolume 类的 Class 对象。使用 getDeclaredMethod() 方法获取 getPathFile() 方法的 Method 对象。使用 invoke() 方法调用 getPathFile() 方法,并将结果强制转换为 File 类型。
2024-01-08 13:48:21 490
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人