I currently have an activity that does not have an xml layout file. All items are added when needed. I am not in need to add a image to it and it doesnt seem to do anything…
ImageView iv = new ImageView(this);
iv.setScaleType(ImageView.ScaleType.FIT_CENTER);
Bitmap bm = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()+"/Pics/Pic_1.jpg");
iv.setImageBitmap(bm);
ll.addView(iv);
The image is in the correct folder…11 at the end is the Linear view i am adding the image view too…am i missing something?
You can use debugger to see if image is loaded correctly.
And have you tried to set layout params on that ImageView. Because in your case it wouldn’t take any space (I think). Try something like:
Or use exact sizes instead of LayoutParams.WRAP_CONTENT