hamid_c
hamid_c

Reputation: 849

onCreateView() called from where and when and what is its parameters when called?

lets assume that we have 2 activity

1: MainActivity (we call this A)

2: FragmetnActivity (B)

A in its layout only had a FrameLayout to hold B

Based on this guid when A is in its onCreate() the first four method of B would called respectively, yes??? they called one-by-one by A or no the A just call the first method and the rest execute respectively???

and about onCreateView() parameters, i know that it had 3 parameters (here):

public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

i want to now what would be the second parameters (ViewGroup container) when this method called by caller in my example???

Upvotes: 0

Views: 923

Answers (1)

Blackbelt
Blackbelt

Reputation: 157437

Don't call it manually. onCreateView is part of the Fragment's lifecycle and calling it and the timing is up to Android.

i want to now what would be the second parameters (ViewGroup container) when this method

is the container that will host the fragment. You usually provide it through a transaction in the add/replace methods

Upvotes: 2

Related Questions