我有没有办法从URL获取图片(图片)而无需下载?我使用下面的代码来获得流媒体视频和音频。但它不适用于图片。Android - 无需下载即可从网址获取图片
public static void IntentPlayer(Context context, Uri uri, int mode){
String type;
switch(mode){
case 1: type = "video/*"; break;
case 2: type = "audio/*"; break;
case 3: type = "image/*"; break;
default: return;
}
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(uri, type);
context.startActivity(intent);
}
的logcat:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://192.168.43.1:6789/mobile_base/Tulips.jpg typ=image/* flg=0x10000000 }
我不想下载的文件之前,我打开它。我会感谢你的回答。谢谢。
你试图对图像做什么?下载图像,然后在应用程序的视图中显示它? – Stevy888
什么都没有。只显示给用户。 – Nolesh
显示如何?在应用程序中,在浏览器中,什么? – Stevy888