Google has introduced the Fragment concept from 3.0 onwards, using Fragment instead of multiple activity, if you still stay 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,
To take a scene, delete a file, use dialogfragment pop-up user selection, how do you know if the user is determined or canceled, and you do not know when the dialogfragment disappears, because there is no UI event triggered, you do not know to refresh the list,
However, I know that as long as I have a problem, on StackOverflow here can definitely 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 the Fragment. Onactivityresult () can receive a callback, think about it, this is actually a function call, not processed by the system,,,
This example of 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