android - Loading images from sd card/folder in gridview -


i want load images sd card or specific folder in android application , show dialog onclick.
i tried code below,but application stopping unexpectedly.
and contents of main.xml.
please help.thanks in advance.

public class imageadapter extends baseadapter {  private context mcontext; private bitmap[]mis_fotos;  public imageadapter(context c) {     mcontext = c;    }  public int getcount() {     get_images();     return mis_fotos.length;     }  public object getitem(int position) {     return null;    }  public long getitemid(int position) {     return 0;    }  public view getview(int position, view convertview, viewgroup parent) {     imageview imageview;     if (convertview == null) {         imageview = new imageview(mcontext);         imageview.setlayoutparams(new gridview.layoutparams(200, 150));         imageview.setscaletype(imageview.scaletype.center_crop);         imageview.setpadding(0, 0, 0, 0);     } else {         imageview = (imageview) convertview;     }     imageview.setimagebitmap(mis_fotos[position]);     return imageview; }  private void get_images(){     file directory = new file(variables.path_fotos);         file[] archivos =directory.listfiles();     mis_fotos= new bitmap[archivos.length];      (int cont=0; cont<archivos.length;cont++){          file imgfile = new  file(archivos[cont].tostring());                         mis_fotos[cont] = bitmapfactory.decodefile(imgfile.getabsolutepath());     }    } } 


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -