I am trying to open a specific folder in android ?Is it possible to open a specific folder ???? this is the code i m using
config=(Button)findViewById(R.id.btn_cf);
config.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent("Intent.ACTION_GET_CONTENT");
Uri uri = Uri.parse("mnt/sdcard/myfiles/allfiles/download");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "download"));
}
});
It works:
Uri selectedUri = Uri.parse(Environment.getExternalStorageDirectory() + "/myFolder/");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(selectedUri, "resource/folder");
startActivity(intent);
Have a nice codding :)
EDIT: If the current solution doesn't help you, then these file/directory choosers libraries can be helpful: https://android-arsenal.com/tag/35
try to replace your code with this line
btn.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ "/myFolder/");
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Open folder"));
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With