简体   繁体   English

android在默认图库查看器中显示图像

[英]android show image in default gallery viewer

I am loading some images into my activity using an AsyncTask as clickable images. 我使用AsyncTask作为可点击图像将一些图像加载到我的活动中。 On click I need to open that image in the default image viewer of the android. 点击后我需要在android的默认图像查看器中打开该图像。 I am new to android. 我是android的新手。 Can any one please help. 任何人都可以帮忙。 My code looks like 我的代码看起来像

ImageView image = new ImageView(this);
String ed="http://www.domain.com/image.jpg";
image.setTag(ed);
DownloadImagesTask td=new DownloadImagesTask(this);
td.execute(image);

image.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View v) {
         Log.v("TAGG","sdsd"); 
      }
});

Please help me. 请帮我。

Gallery application does not accept URL for an image as part of the Intent. Gallery应用程序不接受作为Intent一部分的图像的URL。 You need to save the image first. 您需要先保存图像。 Then you can launch the default image viewer with something like this: 然后,您可以使用以下内容启动默认图像查看器:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + "/sdcard/test.jpg"), "image/*");
startActivity(intent);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM