Sapient Company Programming

Which of the following sequences of Fragment lifecycle methods is correct?

1) onAttach() --> onStart() --> onCreate() --> onCreateView() --> onActivityCreated() --> onResume()

2) onAttach() --> onCreate() --> onStart() --> onCreateView() --> onActivityCreated() --> onResume()

3) OnAttach() --> onCreate() --> onCreateView() --> onActivityCreated() --> onStart() --> onResume()

4) onAttach() -->onStart() --> onCreate() --> onActivityCreated() --> onCreatedView() --> onResumse()

Read Solution (Total 1)

Sapient Other Question

To create a fragment, which of the following options holds true?

1) Extend android.app.Fragment class
and create using code snippet below
public class Fragment_Name extends Fragment{
.....

2) Extend android.app.FragmentClass class
and create using code snippet below:
public class Fragment_Name extends Fragment{
....

3) Extend android.app.Fragment class
and create using code snippet below:
public class Fragment_Name extends FragmentClass{
....

4) None of the given options
In Which of the following situations is it best to use Singleton?

1) If an object has READ_ONLY state (all attributes are final)

2) If an obejct does not have any state (say, no attributes, only methods)

3) If an object has shared state (attributes are present, but those are modified by many of the other objects)

4) All of the given options