In my application, I have a connection to a server and I want to transfer a file on it. So first, I have to select a file. I open a file browser with this code :
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
intent.setType("*/*");
startActivityForResult(intent, REQUEST_BROWSE_FILES);
The problem arrive if I have a disconnection during time I browse to find a file. If the connection is lost, I want to popup a message box saying : "Connection lost" then I want to close the file picker. How can I do something similar to that ?
In fact, when the disconnection occur, I don't know which activity is on top to show a message. Did I miss something, but it is annoying to need an activity to popup a dialog.
Thank you for your help.