The "Error finding album" issue is most likely due to the fact that the "DCIM" folder that you get the bucketId from in your code does not have any images directly in it. You should not get the error if for example you use "/DCIM/Camera" instead (assuming there are some images there).
However, if I understand correctly what you want, I believe there are additional modifications that you need to make on the Gallery3D code in order to make it display a specific folder when launched if you follow this route (since the code is just not designed to be used like that).
Instead of using your code above, I believe you can achieve what you want more easily 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 are doing here is leveraging the ACTION_VIEW intent handling of the app when it is supplied with a vnd.android.cursor.dir/image MIME type.