How to Open Folder specifed in edittext android
Am working on showing images from gallery BELOW IS THE CODE. HERE i want to open images in a specific folder which name will be given in a edit text. Please help me in doing it as currently its opening all the images which is irrelevant to the application and hard for me to identify the images
protected void LoadGalleryImages() {
final String[] columns = { MediaStore.Images.Media.DATA,
MediaStore.Images.Media._ID };
final String orderBy = MediaStore.Images.Media._ID;
imagecursor = managedQuery(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,
null, orderBy);
int image_column_index = 0;
if (imagecursor != null) {
image_column_index = imagecursor
.getColumnIndex(MediaStore.Images.Media._ID);
count = imagecursor.getCount();
}
imgSelected = new String[count];
arrPath = new String[count];
thumbnailsselection = new boolean[count];
for (int i = 0; i < count; i++) {
if (imagecursor != null) {
imagecursor.moveToPosition(i);
// int id = imagecursor.getInt(image_column_index);
int dataColumnIndex = imagecursor
.getColumnIndex(MediaStore.Images.Media.DATA);
arrPath[i] = imagecursor.getString(dataColumnIndex);
}
}
}
1 Answer
Here is the code to open your specified folder to browse your files:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse("folder path");
//Change content type as you want if you dont know then just mention "*/*"
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Open folder"));
No comments:
Post a Comment