Lab5 - Fragments To add a Fragment to a layout, you can do...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Fragments CMSC 436 Lab 5 Derek Juba
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fragments In this lab you will create a layout that contains two Fragments Each Fragment will have a text label and a button that will show or hide the other Fragment
Background image of page 2
Fragments
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fragments Clicking the Show/Hide Fragment B button will hide Fragment B Clicking the button again will bring Fragment B back
Background image of page 4
Fragments
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fragments Clicking the Show/Hide Fragment A button will perform a similar action on Fragment A
Background image of page 6
Fragments
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Fragments Note that for this lab you may need to use the Android emulator version 3 (the tablet emulator)
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fragments To add a Fragment to a layout, you can do something like linearLayout.setId(1); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentA = new FragmentA(); fragmentTransaction.add(linearLayout.getId(), fragmentA); fragmentTransaction.commit(); Fragments To show and hide the Fragments you can do something like if (fragmentA.isHidden()) { fragmentTransaction.show(fragmentA); } else { fragmentTransaction.hide(fragmentA); }...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 436 taught by Professor Porter during the Fall '11 term at Maryland.

Page1 / 10

Lab5 - Fragments To add a Fragment to a layout, you can do...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online