btnimport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent fileintent = new Intent(Intent.ACTION_GET_CONTENT);
fileintent.setType("*/*");
try {
startActivityForResult(fileintent, requestcode);
} catch (ActivityNotFoundException e) {
}
}
});`
I'm trying to import sky.csv file in my Android application.
But, when I select file, I'd get:
IO Exception : open failed: ENOENT (No such file or directory)
I will check path in:
LOG > content://com.android.externalstorage.documents/document/38F0-D5E4%3ADCIM%2Fsky.csv i'm using this method for getting path `
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (data == null)
return;
switch (requestCode) {
case requestcode:
Uri filepath1 = data.getData();
String filepath = filepath1.toString();
Please help me with this. I have tried so many methods. I didn't get any proper solution, however.
You may want to try the codes below. It fetch files from device's providers
PathUtils.java
class is added below.