Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 29da6c2

Browse files
cezannecAsser
cezannec
authored and
Asser
committed
TFragments.02-Exercise-DisplayThreeFragments
1 parent 9636797 commit 29da6c2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

app/src/main/java/com/example/android/android_me/ui/AndroidMeActivity.java

+5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ protected void onCreate(Bundle savedInstanceState) {
3434
// Create a new head BodyPartFragment
3535
BodyPartFragment headFragment = new BodyPartFragment();
3636

37+
// TODO (4) Set the list of image id's for the head fragment and set the position to the second image in the list
38+
3739
// Add the fragment to its container using a FragmentManager and a Transaction
3840
FragmentManager fragmentManager = getSupportFragmentManager();
3941

4042
fragmentManager.beginTransaction()
4143
.add(R.id.head_container, headFragment)
4244
.commit();
45+
46+
// TODO (5) Create and display the body and leg BodyPartFragments
47+
4348
}
4449
}

app/src/main/java/com/example/android/android_me/ui/BodyPartFragment.java

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828

2929
public class BodyPartFragment extends Fragment {
3030

31+
// TODO (1) Create a setter method and class variable to set and store of a list of image resources
32+
33+
// TODO (2) Create another setter method and variable to track and set the index of the list item to display
34+
// ex. index = 0 is the first image id in the given list , index 1 is the second, and so on
35+
3136
/**
3237
* Mandatory empty constructor for the fragment manager to instantiate the fragment
3338
*/
@@ -49,6 +54,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
4954
// Set the image to the first in our list of head images
5055
imageView.setImageResource(AndroidImageAssets.getHeads().get(0));
5156

57+
// TODO (3) If a list of image ids exists, set the image resource to the correct item in that list
58+
// Otherwise, create a Log statement that indicates that the list was not found
59+
5260
// Return the rootView
5361
return rootView;
5462
}

0 commit comments

Comments
 (0)