我的资产文件夹中有一个图像(welcome_image.jpg)。并使用此代码从资产中读取。从资产文件夹中读取图像文件
Bitmap bit = null;
String url = "/assets/welcome_image.jpg";
bit = BitmapFactory.decodeFile(url);
但位是空和投掷误差
03-26 16:42:15.303: D/Image exisits....(21547): Image url : /assets/welcome_image.jpg
03-26 16:44:39.853: E/BitmapFactory(21547): Unable to decode stream: java.io.FileNotFoundException: /assets/welcome_image.jpg: open failed: ENOENT (No such file or directory)
请告诉我如何实现这一目标。
试试这个 InputStream ims = getAssets()。open(“welcome_image.jpg”); //载入图像为可绘制 Drawable d = Drawable.createFromStream(ims,null); – 2013-03-26 11:24:43