The onActivityResult()
is a little like onOptionMenuSelected()
, in the way that:
- Based on the params, you can tell if this function call should be processed in this level
- if so, process with it and return (true)
- if not, just call the super class's implementation
Therefore, in your Fragment's onActivityResult()
, you should first check if the requestCode
meets what you set before, if so, deal with the data and return. If not, just return with super.onActivityResult()
.
A simple sample may look like:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case SELECT_FILE_TO_UPLOAD:
// upload a file
return;
case SELECT_FILE_TO_DELETE:
// delete a file
return;
default:
super.onActivityResult(requestCode, resultCode, data);
}
}