我正在尝试从Mediastore.Images.Media中检索图像,但总是将光标设置为空。请建议如何解决此问题。提前感谢
Uri contenturi = Images.Media.getContentUri("phoneStorage");
String[] mprojection = { MediaStore.Images.Media.DATA };
String mselection = null;
String[] mselectionArgs = null;
String msortOrder ="date_added DESC";
Cursor mcursor = managedQuery(contenturi, mprojection, mselection, mselectionArgs, msortOrder);当我检查mcursor为null时,我尝试将uri更改为外部存储,也尝试了没有排序顺序。但它仍然返回null。请帮帮忙
发布于 2012-11-12 20:15:15
巴迪试试这段代码,
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,getResources().getString(R.string.accept)),1);现在只需使用onActivityResult方法从Gallery获取图像。
https://stackoverflow.com/questions/13343134
复制相似问题