public void fileSearching(){
try{
// find1, find2 are buttons that open the file explorer
find1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
Intent i = new Intent();
i.setAction(Intent.ACTION_GET_CONTENT);
i.setType("file/*");
check = 0;
startActivityForResult(i, CODE);
}
});
find2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent();
i.setAction(Intent.ACTION_GET_CONTENT);
i.setType("file/*");
check = 1;
startActivityForResult(i, CODE);
}
});
}
catch (Exception ex){}
}
@Override
public void onActivityResult(int request, int result, Intent data){
if (request == CODE && result == RESULT_OK){
Uri u = data.getData();
String path = data.getData().getPath();
}
}
Retrurns /external/file/59 but i need /sdcard/downloads/... + file name
I need this because i want to get a sha-1,md5,... hash for any file.
If i use the "/external/file/xx" it gives me a FileNotFoundException.
I've tried some solutions that were already presented but none seemed to work for me or i didn't know how to use it