android - GridView only lists first image in directory -


I am trying to display all the images in a GridView in a certain directory, but only the first image is displayed Has been there. Here's what I am using:

OnCreate:

  iconGrid = (GridView) findViewById (R.id.iconGrid); GetImageFiles (); IconGrid.setAdapter (New ImageAdapter (this));   

getImageFiles ():

  public zero getImageFiles () {file dir = new file (environment .getExternalStorage directory ("," IMG "); For (dir.isDirectory ()) (file F: dir.listFiles ()) (string EXT: IMAGE_EXTENSIONS) if (f.getName (). ToLowerCase (). EndsWith (ext)) {Log.d ( F ToString (), "Adding File"); Files.add (f.getAbsolutePath ()); }}   

imageAdapter ()

  public class ImageAdapter BaseAdapter extended {personal reference reference; Public imageadapter (reference reference) {this.context = context; } Public int getCount () {back files.size (); } Public object getItem (status of int) {return status; } Public ITMID in the long run (status of return) {Return Status; } View public viewView (int position, seeviewview, ViewGroup parents) {Log D ("", "get image" + files.get (status) .toString ()); Image view c; If (convertView == faucet) {c = New ImageView (reference); C.setLayoutParams (New GridView.LayoutParams (160, 160)); C.setScaleType (ImageView.ScaleType.CENTER_CROP); C.setPadding (8,8,8,8); } And {c = (ImageView) ConvertView; } Bitmap myBitmap = BitmapFactory.decodeFile (files.get (status)); C.setImageBitmap (myBitmap); Return c; }}   

With logging in place, it seems that getView () is never called for those terms which are not 0, and each file in the list is added to the list. Being the right number of files is going to happen why this is happening?

All were being added to the gridview, it was not visible only without scrolling and the number of columns Varies.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -