在我的应用程序中显示使用第三方android应用程序捕获的照片

在我的应用程序中显示使用第三方android应用程序捕获的照片,android,android-layout,android-intent,android-emulator,Android,Android Layout,Android Intent,Android Emulator,我无法显示使用第三方android应用程序拍摄的当前图像,也无法在我自己的本机应用程序上显示。它总是一个只有操作栏的空屏幕。但是,拍摄的照片可能位于我指定的文件夹中 有人能帮忙吗?非常感谢!干杯:) XML文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation=

我无法显示使用第三方android应用程序拍摄的当前图像,也无法在我自己的本机应用程序上显示。它总是一个只有操作栏的空屏幕。但是,拍摄的照片可能位于我指定的文件夹中

有人能帮忙吗?非常感谢!干杯:)

XML文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:id="@+id/linear">

  <ImageView android:id="@+id/imageView1"
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:contentDescription="@string/desc"/>
</LinearLayout>
将上述行添加到ImageView的xml中,其中desc应位于string.xml中,并将其设置为某个值。 看起来这定义了简要描述视图内容的文本。此属性主要用于辅助功能。由于某些视图没有文本表示,因此可以使用此属性来提供此类属性

像ImageView和ImageButtons这样的非文本小部件应该使用contentDescription属性来指定小部件的文本描述,以便屏幕阅读器和其他辅助工具能够充分描述用户界面

String  selectedImagePath = getPath(selectedImageUri);
Bitmap myBitmap = BitmapFactory.decodeFile(selectedImagePath);
imageView.setImageBitmap(bmp);
使用上述代码

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

是否在
活动中保存
fileUri
的值?如果是,您是否正在从保存的实例中恢复它


如果没有,则可能在活动被销毁时重置。

第三方应用程序的图像存储在哪里?您好,我已将其指定在SD卡->图片->MyCreatedFolder上,然后您可以从SD卡获取图像文件名并将其放置在ImageView中。这么简单?您遇到的问题在哪里?我不知道是否可以让上面的代码正常工作。它在我拍摄图像后显示一个空白屏幕。那么您是否选择photogallery,然后放置图像?Hi Amit。那不是我真正想要的。我想要的是显示我刚刚从当前意图中捕获的照片。同时,我的imageview出现此错误“[Accessibility]缺少图像上的contentDescription属性”。你能帮忙吗。我现在拥有的是一个只有一个动作栏的空白屏幕。我想通过图像视图显示我刚刚拍摄的照片。谢谢嗨,阿米特,我已经编辑了我的帖子,并附上了我所有的完整源代码。
String  selectedImagePath = getPath(selectedImageUri);
Bitmap myBitmap = BitmapFactory.decodeFile(selectedImagePath);
imageView.setImageBitmap(bmp);
public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}