Reputation: 73
I am creating an application and I would like to select a file in my phone. Do you have ideas to do it?
I would like that when I click on the icon it opens to me the files of the phone (I do not necessarily want the code to be finished, but just creser tracks)
Upvotes: 0
Views: 43
Reputation: 301
Start an intent to get the files with:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent,PICKFILE_RESULT_CODE);
and receive the picked file with:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode){
case PICKFILE_RESULT_CODE:
if(resultCode==RESULT_OK){
String FilePath = data.getData().getPath();
...
}
break;
}
}
Upvotes: 1