小编Mad*_*din的帖子

Android PNG到Bitmap --- SkImageDecoder :: Factory返回null

我正在尝试从我的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)

android bitmap bitmapfactory android-bitmap

7
推荐指数
1
解决办法
1915
查看次数

标签 统计

android ×1

android-bitmap ×1

bitmap ×1

bitmapfactory ×1