Data transfer between the fragment

Data transfer between the fragment

1 startActivityForResult

When you want to write a lot of input and user input required more space applications, and applications to support mobile phones and flat-panel display devices, using onActivityResult (...) method returns the data to the target fragment is more convenient. Phone screen space is limited, it is often necessary to use full-screen fragment acticvity hosted interface to display user input requirements. The activity sub-activity will start by the parent fragment to invoke startActivityForResult (...) method. After the sub-activity is destroyed, the parent activity will receive onActivityResult (...) method invocation request, and forwarded to the promoter activity of the fragment

2 show

Screen space tablet device is relatively large, suitable for a pop-up dialog box displayed information and accept user input. In this case, you should set the target fragment and fragment of the dialog box invoked show () method. After the dialog is canceled, the dialog fragment calls onActivityResult target fragment of (...) method

 

Guess you like

Origin www.cnblogs.com/changshengee/p/11205020.html