1 00:00:00,000 --> 00:00:04,733 [MUSIC] 2 00:00:04,733 --> 00:00:06,410 Hi I'm Ben. 3 00:00:06,410 --> 00:00:09,820 And in this course, we'll be learning all about fragments. 4 00:00:09,820 --> 00:00:13,760 But before we talk about fragments, let's take a quick trip back in time. 5 00:00:15,040 --> 00:00:16,789 The year was 2011. 6 00:00:16,789 --> 00:00:21,589 We saw Charlie Sheen's very public meltdown, Oprah's last episode, and 7 00:00:21,589 --> 00:00:25,420 most importantly, we got a new version of Android. 8 00:00:25,420 --> 00:00:29,980 Honeycomb, Android's first and, so far, only tablet specific update. 9 00:00:31,040 --> 00:00:36,590 Honeycomb brought tons of new features to make working with tablet UIs a lot easier. 10 00:00:36,590 --> 00:00:40,750 By far, the biggest of these new features was Fragments. 11 00:00:40,750 --> 00:00:41,809 With Honeycomb, 12 00:00:41,809 --> 00:00:46,840 developers could now break up activities into sub-components called fragments. 13 00:00:46,840 --> 00:00:47,490 Here's an example. 14 00:00:49,100 --> 00:00:51,290 Let's say we're making an address book. 15 00:00:51,290 --> 00:00:53,620 We need a list for all of our contacts. 16 00:00:53,620 --> 00:00:58,270 And when we click on a contact, we see a new screen with more details. 17 00:00:58,270 --> 00:00:59,730 But how does this look on a tablet? 18 00:01:01,160 --> 00:01:02,770 Not so good. 19 00:01:02,770 --> 00:01:07,310 Luckily, with fragments, we can make this look a lot better. 20 00:01:07,310 --> 00:01:12,550 Instead of doing most of our UI in the activity, we can do it in the fragments. 21 00:01:12,550 --> 00:01:17,120 We can have a list fragment for our contact list and a details fragment for 22 00:01:17,120 --> 00:01:17,950 the details page. 23 00:01:18,990 --> 00:01:22,640 Then, regardless of whether a user is on a phone or 24 00:01:22,640 --> 00:01:25,800 a tablet, we can display the best UI possible. 25 00:01:26,810 --> 00:01:29,680 Now that we have a vague notion of what fragments are, 26 00:01:29,680 --> 00:01:32,460 let's take a look at the project we'll be working on. 27 00:01:32,460 --> 00:01:33,330 I don't know about you, 28 00:01:33,330 --> 00:01:37,970 but one of the most-used apps on my tablet is a recipe app. 29 00:01:37,970 --> 00:01:42,640 So for this course we'll be making a breakfast themed recipe app named 30 00:01:42,640 --> 00:01:44,280 Smells Like Bacon. 31 00:01:44,280 --> 00:01:45,090 Here it is in action. 32 00:01:46,310 --> 00:01:49,760 On a phone we have a list with all the recipes. 33 00:01:49,760 --> 00:01:54,590 And when we click on a recipe, we get a new screen with two tabs, one for 34 00:01:54,590 --> 00:01:57,340 ingredients and one for directions. 35 00:01:57,340 --> 00:02:01,050 On a tablet we have a grid with all the recipes. 36 00:02:01,050 --> 00:02:04,070 And when we click on a recipe, we get a new screen with 37 00:02:04,070 --> 00:02:07,000 the ingredients on the left and the directions on the right. 38 00:02:08,720 --> 00:02:10,240 It's a lot to cover. 39 00:02:10,240 --> 00:02:11,620 But at the end of this course, 40 00:02:11,620 --> 00:02:14,240 you should have an excellent understanding of fragments.