Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有6.0权限控制 #15

Open
VDshixiaoming opened this issue Feb 16, 2017 · 4 comments
Open

没有6.0权限控制 #15

VDshixiaoming opened this issue Feb 16, 2017 · 4 comments

Comments

@VDshixiaoming
Copy link

启动就蹦,手动开了摄像和存储访问权限后才能运行。选择图片时往下滑就会报错,在PhotoPickerActivity的OnDestroy加

if(mProgressDialog != null){
            mProgressDialog.dismiss();
        }

后面滑动还是会报空指针错误

@VDshixiaoming
Copy link
Author

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
at com.lling.photopicker.utils.ImageLoader.cacheBitmap2Disk(ImageLoader.java:317)

@yangkile
Copy link

你这种问题。。完全没法回答,照片权限不都是自己写吗。。

@835700012
Copy link

May I have a question?
how to use the picker in the dialog?

@perfunctory
Copy link

在执行内存缓存的线程里,把空值异常捕捉一下,可能是解析的图片出现问题
class DiskCacheThread extends Thread {

    String path;
    Bitmap bitmap;

    public DiskCacheThread(String path, Bitmap bitmap) {
        this.path = path;
        this.bitmap = bitmap;
    }

    @Override
    public void run() {
        try {
            String key = OtherUtils.hashKeyForDisk(path);
            DiskLruCache.Editor editor = mDiskLruCache.edit(key);
            if (editor != null) {
                OutputStream outputStream = editor.newOutputStream(0);
                if (cacheBitmap2Disk(bitmap, outputStream)) {
                    editor.commit();
                } else {
                    editor.abort();
                }
            }
            mDiskLruCache.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }catch (NullPointerException e){
            e.printStackTrace();
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants