开发者

android drawable from file path

开发者_StackOverflow社区I have a file path String of the form "e:\...\xxx.jpg" How do I create a drawable from it?


You can create a Drawable or Bitmap from a string path like this:

String pathName = "/path/to/file/xxx.jpg"; 
Drawable d = Drawable.createFromPath(pathName);

For a Bitmap:

String pathName = "/path/to/file/xxx.jpg";
Bitmap b = BitmapFactory.decodeFile(pathName);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜