共用方式為


Fragment.SetTargetFragment(Fragment, Int32) Method

Definition

Optional target for this fragment.

[Android.Runtime.Register("setTargetFragment", "(Landroid/app/Fragment;I)V", "GetSetTargetFragment_Landroid_app_Fragment_IHandler")]
public virtual void SetTargetFragment (Android.App.Fragment? fragment, int requestCode);
[<Android.Runtime.Register("setTargetFragment", "(Landroid/app/Fragment;I)V", "GetSetTargetFragment_Landroid_app_Fragment_IHandler")>]
abstract member SetTargetFragment : Android.App.Fragment * int -> unit
override this.SetTargetFragment : Android.App.Fragment * int -> unit

Parameters

fragment
Fragment

The fragment that is the target of this one.

requestCode
Int32

Optional request code, for convenience if you are going to call back with #onActivityResult(int, int, Intent).

Attributes

Remarks

Optional target for this fragment. This may be used, for example, if this fragment is being started by another, and when done wants to give a result back to the first. The target set here is retained across instances via FragmentManager#putFragment FragmentManager.putFragment().

Java documentation for android.app.Fragment.setTargetFragment(android.app.Fragment, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to