Google has introduced the Fragment concept from the beginning of 3.0, replacing multiple activity with Fragment, assuming you are still in the activity era, then you wall go!
Fragment is good, but a few questions,
1. In the Viewpager, you do not know whether Fragment is currently showing or hiding state, is missing a onshow onhide callback
2. This is the customer problem, showing a dialogfragment callback problem,
For a scene, delete a file. With dialogfragment pop-up user selection, how do you know if the user is determined or canceled, and you do not know when this dialogfragment disappeared, because there is no trigger no matter what UI event, you do not know to refresh the list,
However, I know that only if I have a problem, on StackOverflow here will be able to search the answer
Http://stackoverflow.com/questions/13733304/callback-to-a-fragment-from-a-dialogfragment
That's the problem.
Principle:
Fragment has
@Override
public void Onactivityresult (int requestcode, int resultcode, Intent data)
Callback, when you call getparentfragment () in Fragment. Onactivityresult () can receive a callback, think carefully. This is actually a function call, which has not been processed by the system.
The example on StackOverflow is more reasonable and uses
Dialogfrag.settargetfragment (this, dialog_fragment);
Gettargetfragment (). Onactivityresult (Gettargetrequestcode (), ACTIVITY.RESULT_OK, Getactivity (). GetIntent ());
Combination. More Reasonable
Android Dialogfragment Callback to Fragment