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

图片处理失败 #3

Open
huaerlala opened this issue Jul 4, 2016 · 4 comments
Open

图片处理失败 #3

huaerlala opened this issue Jul 4, 2016 · 4 comments

Comments

@huaerlala
Copy link

if (resultCode == Activity.RESULT_OK && requestCode == SYSTEM_GALLERY) {
Uri uri = data.getData();
String[] pojo = {MediaStore.Images.Media.DATA};
Cursor cursor = this.managedQuery(uri, pojo, null, null, null);
if (cursor != null) {
// ContentResolver cr = this.getContentResolver();
int colunm_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String path = cursor.getString(colunm_index);
//以上代码获取图片路径
Uri.fromFile(new File(path));//Uri.decode(imageUri.toString())
mEditorFragment.getPerformEditable().perform(R.id.id_shortcut_insert_photo, Uri.fromFile(new File(path)));
} else {
Toast.showShort(this, "图片处理失败");
}
}

这段代码处理有问题!cursor很多时候为空。

@qinci
Copy link
Owner

qinci commented Jul 4, 2016

谢谢,回头我重新做一下图片选择!应该是机型适配问题,你能不能提供一下机型和系统版本? @18611480882

@huaerlala
Copy link
Author

小米

@Freshman111
Copy link

小米note 有这个问题

@Yanqilong
Copy link

小米4有这个问题

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