Select chapter



basics (6.papers)
activities (5.papers)
services (2.papers)
threads (2.papers)
receivers (1.papers)
advanced android (2.papers)
SQLite database (1.papers)
adapters (1.papers)
adb and ddms (1.papers)
widgets (1.papers)
fragments (1.papers)
UI (1.papers)
Hide

Sponsored Links


  

android fragments interview questions and answers

1
What is true about a Fragment?
  1. I can use a Fragment with out an Activity.
  2. A fragment can have multiple activities in it.
  3. An activity can contain multiple fragments in it.
  4. A fragment designed in one activity can't be reused in other activity.
Show Answer
Share Facebook gmail Twitter
2
When activity is moved to stopped state, then what will happen to the life cycle of a fragment which is in that activity?
  1. fragments life cycle is not dependent on activity's. So there won't be any effect for fragment life cycle.
  2. Option 1 is true because fragments are independent modules designed for better space usage
  3. fragments will be moved to onStop
  4. both fragments will be destroyed and recreated when activity reaches onResume again.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
4
How to find a fragment in an activity?
  1. findViewById(R.id.frag_id);
  2. FragmentManager.findFragmentById(R.id.frag_id);
  3. LayoutManager.findFragmentManager(R.id.frag_id);
  4. Context.findFragmentById(R.id.frag_id);
Show Answer
Share Facebook gmail Twitter
5
How to create different layout files portrait and landscape orientations?
  1. it is not possible.
  2. put two different files in layout folder, use one for portrait and other for landscape, based on orientation change.
  3. use layout-port folder for portrait mode, and layout-land for landscape mode.
  4. use layout-port folder for portrait mode, and layout folder for landscape mode.
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
7
Is it possible to have fragments without UI, in android?
  1. Fragment will never have any UI.
  2. Fragment generally will contribute its UI by using its own layout. But it might not have UI in some cases, as it is not mandatory.
  3. Both option 1 & 2 are right.
  4. none of the above are true. Because fragments should always have its own layout and contribute its UI.
Show Answer
Share Facebook gmail Twitter
8
How to create an activity which has fragment with listview?
  1. use Activity, fragment, a layout which will have list view.
  2. use activity & a ListFragment
  3. Use only Activity with a layout which is having a list view in it.
  4. Use only a ListFragment with out any activity.
Show Answer
Share Facebook gmail Twitter
9
Which of the below is not a Fragment class.
  1. Fragment
  2. DialogFragment
  3. PreferenceFragment
  4. ActivityFragment
Show Answer
Share Facebook gmail Twitter
10
Which of the below functions are not part of Fragment life cycle?
  1. onCreateView()
  2. onDetach()
  3. onActivityDestroyed()
  4. onActivityCreated()
Show Answer
Share Facebook gmail Twitter
11
Which of the below are correct sequence of Fragment life cycle?
  1. onAttach()
    onCreate()
    onCreateView()
    onStart()
    onActivityCreated()
    onResume()
  2. onAttach()
    onCreateView()
    onCreate()
    onActivityCreated()
    onStart()
    onResume()
  3. onAttach()
    onCreate()
    onCreateView()
    onStart()
    onActivityCreated()
    onResume()
  4. onAttach()
    onCreate()
    onCreateView()
    onActivityCreated()
    onStart()
    onResume()
Show Answer
Share Facebook gmail Twitter
12
Suppose X is a fragment activity, Y and Z are fragments where Y is the default screen displayed.If we have to open Z,then
  1. Y must use fragment manager to open screen Z.
  2. Y must use intent to open the screen Z.
  3. Y must use fragment- transaction with fragment-manager and replace itself with screen Z. 
  4. None are correct.
Show Answer
Share Facebook gmail Twitter
13
What is a fragment in android?
  1. Fragment is a part of an activity, which contributes its own UI to that activity. Fragment can be thought like a sub activity.
  2. Fragments are used to efficiently use the space in wider screen devices.
  3. An activity may contain 0 or multiple number of fragments based on the screen size. A fragment can be reused in multiple activities, so it acts like a reusable component in activities.
  4. all are true
Show Answer
Share Facebook gmail Twitter
14
What is the difference between activity and fragment in android?
  1. fragment is a part of an activity, which contributes its own UI to that activity. Fragment can be thought like a sub activity. Where as the complete screen with which user interacts is called as activity. An activity can contain multiple fragments.Fragments are mostly a sub part of an activity.
  2. An activity may contain 0 or multiple number of fragments based on the screen size. A fragment can be reused in multiple activities, so it acts like a reusable component in activities.
  3. A fragment can't exist independently. It should be always part of an activity. Where as activity can exist with out any fragment in it.
  4. all are true
Show Answer
Share Facebook gmail Twitter
15
Why fragments in android? What is the use?
  1. Fragments are used to efficiently use the space on wider screen devices.
  2. fragments are used as a means of solving compatibility issues when targeting an android application for various screen sizes, esp for both tablets and mobiles.
  3. Fragments can be used to reuse the same piece of UI template in multiple activities, without rewriting the entire code. These are kind of reusable components which fits into an activity.
  4. all are true
Show Answer
Share Facebook gmail Twitter
Read more papers :