我正在尝试从我的Environment.getExternalStorageDirectory()加载屏幕截图并尝试将其转换为位图
public void onPictureTaken(String path) throws IOException {
String photoPath = filepath + "/" + path;; //UPDATE WITH YOUR OWN JPG FILE
File directory = new File (filepath);
File file = new File(directory, path);
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(photoPath, options);
// Calculate inSampleSize
options.inSampleSize = 4;
options.inJustDecodeBounds = false;
BitmapFactory.decodeFile(photoPath, options);
}
Run Code Online (Sandbox Code Playgroud)
--- SkImageDecoder :: Factory返回null
这是我调用onPictureTaken的函数:
private void observeSceenshot(){
filepath = Environment.getExternalStorageDirectory()
+ File.separator + Environment.DIRECTORY_PICTURES
+ File.separator + "Screenshots";
Log.d(TAG, filepath);
FileObserver fileObserver …Run Code Online (Sandbox Code Playgroud)