问题
I'm new to Android Development. I have developed a program that capture images via camera and stored in mnt/sdcard/Pictures/MYFOLDER. And also there is another button foe browse images. image save perfectly. But when I browse the taken images by clicking Browse button it only shows these folders: Pictures,Bluetooth,images. When I navigate to Pictures folder MYFOLDER does not exist.
here is my Browse button
Button buttonLoadImage = (Button) findViewById(R.id.btnBrowseimage);
buttonLoadImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(
Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
});
Please guide me.
回答1:
Some times it happens that gallary not show the newly created directory. I don't know why but may be due to not scanned newly created/modified directory.
Solution
Restart your device.
回答2:
Instead of restarting fire this broadcast which will help re-indexing of the newly created folder or file and the resulting folder will be visible in the gallery:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mediaMountUri));
来源:https://stackoverflow.com/questions/21473185/programmatically-created-image-folder-not-shown-in-the-public-folder