I want to show an image in imageview so I made a folder - drawable
in res
and put my image there. Something like apple.png
. Then I use this code:
ImageView iv= (ImageView)findViewById(R.id.img_selected_image);
String path = getApplication().getFilesDir().getAbsolutePath();
InputStream is = new FileInputStream(path + "/apple.png");
Drawable icon = new BitmapDrawable(is);
Log.i("Fnord", "width="+icon.getIntrinsicWidth()+
" height="+icon.getIntrinsicHeight());
iv.setImageDrawable(icon);
But when i run it, it said there isn't any image by apple.png
name in data/data/package-name/files
. I think i put my image in inappropriate place. Where should i put my image ?