Android 获取资产UriString

Android 获取资产UriString,android,uri,inputstream,assets,Android,Uri,Inputstream,Assets,我在寻找一个替代方案 图像。媒体我的资产的外部内容URI(类型字符串uriString) InputStream ims = getAssets().open("a.jpg"); // load image as Drawable Drawable d = Drawable.createFromStream(ims, null); Bitmap bitmap=drawableToBitmap(d); Uri imag

我在寻找一个替代方案 图像。媒体我的资产的外部内容URI(类型字符串uriString)

        InputStream ims = getAssets().open("a.jpg");
        // load image as Drawable
        Drawable d = Drawable.createFromStream(ims, null);
        Bitmap bitmap=drawableToBitmap(d);
        Uri imageUri = Uri.parse( Images.Media.EXTERNAL_CONTENT_URI + "/"  );
        bitmap = ImageLoader.loadFromUri( this, imageUri.toString(), 1024, 1024 );

        mImageView.setImageBitmapReset( bitmap,0,true);
谢谢你可以试试这个:

File file = new File("path_to_image_file");
Uri imageUri = Uri.fromFile(file);

您想用什么替换
图像.媒体.外部内容\u URI
?为什么你不能这样做呢?我想替换这个值Images.Media.EXTERNAL_CONTENT_URI,因为我的图像位于文件夹资产中,我使用一个脚本在Images.Media.EXTERNAL_CONTENT_URI中随机获取图像,但我想更改这个脚本并可以放置我的资产。我想尝试这个InputStream ims=getAssets()。打开(“a.jpg”);File File=新文件(ims.toString());Uri imageUri=Uri.fromFile(文件);但是不起作用