The problem "Album search error" is most likely due to the fact that in the "DCIM" folder, in which you get the bucketId from your code, there are no images directly in it. You should not get an error if, for example, you use "/ DCIM / Camera" (assuming that there are some images there).
However, if I understand correctly what you want, I believe that there are additional changes that need to be made to the Gallery3D code so that it displays a specific folder at startup if you follow this route (since the code is simply not intended for such use).
Instead of using my code above, I believe that you can achieve what you want easier by setting the intent to a specific one in onCreate() :
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setIntentToSpecificFolder(); mApp = new App(Gallery.this); // : // the rest of onCreate() code // : Log.i(TAG, "onCreate"); } private void setIntentToSpecificFolder() { String folderPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera"; int folderBucketId = folderPath.toLowerCase().hashCode(); Uri targetUri = Media.EXTERNAL_CONTENT_URI.buildUpon().appendQueryParameter("bucketId", String.valueOf(folderBucketId)).build(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(targetUri, "vnd.android.cursor.dir/image"); setIntent(intent); }
Basically what we do here is to use the ACTION_VIEW tag ACTION_VIEW application when it comes with the vnd.android.cursor.dir/image MIME type.
source share