Java 所选图像未在mainActivity中显示

Java 所选图像未在mainActivity中显示,java,android,android-studio,sdk,android-camera,Java,Android,Android Studio,Sdk,Android Camera,为什么所选图像没有显示在Claims.java中?我错过什么了吗 mainfest.xml 当我选择图像时,ImageView上没有显示任何内容。但是,如果我从相机中捕捉图像,图像可以显示…为什么 10-22 14:28:11.128 7451-7451/com.example.project.project E/ViewRootImpl﹕ sendUserActionEvent() mView == null 10-22 14:28:15.228 7451-7451/com.exa

为什么所选图像没有显示在Claims.java中?我错过什么了吗

mainfest.xml


当我选择图像时,ImageView上没有显示任何内容。但是,如果我从相机中捕捉图像,图像可以显示…为什么

10-22 14:28:11.128    7451-7451/com.example.project.project E/ViewRootImpl﹕ sendUserActionEvent() mView == null
10-22 14:28:15.228    7451-7451/com.example.project.project E/BitmapFactory﹕ Unable to decode stream: java.io.FileNotFoundException: /https:/lh3.googleusercontent.com/-ZiYOXTFTKqQ/URcxPqvEtTI/AAAAAAAAAJw/GN893VrnxGw/I/PANO_20130210_133321.jpg: open failed: ENOENT (No such file or directory)

这是什么意思?我怎样才能解决这个问题?我如何知道android studio中的sdk版本?请帮帮我。。。。谢谢

正如我在你的日志中看到的那样,你走错了路

开头有一个额外的

您可以尝试:

if(picturePath.startsWith("/")) picturePath = picturePath.substring(1);

我曾经面对过,我就是这样做的

else if (requestCode == 2) {
                Uri selectedImage = data.getData();
               viewImage.setImageURI(selectedImage);

而且它有效!希望这对你也有帮助…祝你好运

你好,我也面临同样的问题,我确实喜欢这个

String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = getActivity().getContentResolver().query(data.getData(),
                    filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String imgDecodableString = cursor.getString(columnIndex);
            cursor.close();

            viewImage.setImageBitmap(BitmapFactory
                    .decodeFile(imgDecodableString));
您只需使用上述代码替换else ifrequestCode==2中的代码


希望这能在c之前解决您的问题。

关闭活动结果。当我选择图像时,ImageView上没有显示任何内容。但是,如果我从相机捕获图像,图像可以显示…为什么?请设置断点,并确保缩略图和d Drawable不为空。尝试在imageView上添加一些背景,以确保它没有被其他内容重叠。请…我仍然认为这是我想要的答案…谢谢:您尝试过@Hoo-answer吗?他的答案对你有用吗?是的我试过了。。但这对网络图像视图不起作用。。。而且图像看起来很杂乱。。。。
if(picturePath.startsWith("/")) picturePath = picturePath.substring(1);
else if (requestCode == 2) {
                Uri selectedImage = data.getData();
               viewImage.setImageURI(selectedImage);
String[] filePathColumn = {MediaStore.Images.Media.DATA};
            Cursor cursor = getActivity().getContentResolver().query(data.getData(),
                    filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String imgDecodableString = cursor.getString(columnIndex);
            cursor.close();

            viewImage.setImageBitmap(BitmapFactory
                    .decodeFile(imgDecodableString));