i'm developing an android gallery application,so i want to open only image/photo folder from when i click the file chooser button,
i'm trying to open it but all unnecessary folders are showing the open activity (music/video/contact/.etc).i want to open only the that image and file folders.
this is my file chooser code. i'm using ACTION_PICK for the open activity
public void showFileChooser(View v) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("/*");
if(Build.VERSION.SDK_INT >= 15 && Build.VERSION.SDK_INT <= 18){
intent.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
intent.setAction(Intent.ACTION_GET_CONTENT);
try {
startActivityForResult(
Intent.createChooser(intent, "Select Picture"),FILE_SELECT_CODE);
} catch (ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
Toast.makeText(this, "Please install a File Manager.",
Toast.LENGTH_SHORT).show();
}
}
else if(Build.VERSION.SDK_INT >= 19){
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY,true);
intent.setAction(Intent.ACTION_PICK);
try {
startActivityForResult(
Intent.createChooser(intent, "Select Picture"),FILE_SELECT_CODE);
} catch (ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
Toast.makeText(this, "Please install a File Manager.",
Toast.LENGTH_SHORT).show();
}
}
else {
Log.e("no","no");
}
}
Thank you.