Android - how to add a dynamic image to activity -


i have activity not have xml layout file. items added when needed. not in need add image , doesnt seem 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 in correct folder...11 @ end linear view adding image view too...am missing something?

you can use debugger see if image loaded correctly. , have tried set layout params on imageview. because in case wouldn't take space (i think). try like:

ll.addview(iv, new linearlayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content)); 

or use exact sizes instead of layoutparams.wrap_content


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -