Hi, please use the following code. You will get a specific image of the folder.
the code:
import java.io.File; import android.app.Activity; import android.content.Intent; import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class SDCARD123Activity extends Activity implements MediaScannerConnectionClient{ public String[] allFiles; private String SCAN_PATH ; private static final String FILE_TYPE="image/*"; private MediaScannerConnection conn; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); File folder = new File("/sdcard/Photo/"); allFiles = folder.list();
Hope this helps you.
source share