1 00:00:00,000 --> 00:00:04,666 [MUSIC] 2 00:00:04,666 --> 00:00:05,795 Welcome back. 3 00:00:05,795 --> 00:00:07,504 We've set up our app project and 4 00:00:07,504 --> 00:00:11,130 now we're ready to display a list of items from Etsy. 5 00:00:11,130 --> 00:00:13,610 To help us interact with the Etsy API, 6 00:00:13,610 --> 00:00:16,530 we're gonna be using two helpful open-source libraries. 7 00:00:17,730 --> 00:00:19,620 The first is called Picasso. 8 00:00:19,620 --> 00:00:23,280 It allows us to load images from the internet without worrying about advanced 9 00:00:23,280 --> 00:00:27,150 topics like caching, multi-threading, or memory constraints. 10 00:00:28,210 --> 00:00:30,580 The second is called Retrofit. 11 00:00:30,580 --> 00:00:34,190 Retrofit enables us to create readable Java interfaces and 12 00:00:34,190 --> 00:00:36,769 classes that match the API we're accessing. 13 00:00:37,860 --> 00:00:42,110 It also allows us to interact with simple Java objects instead of having to 14 00:00:42,110 --> 00:00:44,920 parse network responses manually. 15 00:00:44,920 --> 00:00:49,530 Both Picasso and Retrofit are provided by the same company, Square, 16 00:00:49,530 --> 00:00:55,808 which provides other libraries used at TreeHouse, like OkHttp and Butterknife. 17 00:00:55,808 --> 00:00:59,310 To add these to our project, we need just two lines of code. 18 00:00:59,310 --> 00:01:00,620 Let's jump in and get started. 19 00:01:02,810 --> 00:01:07,030 Code libraries can be added just like we did for Google Play Services. 20 00:01:07,030 --> 00:01:08,838 We open our build.gradle file. 21 00:01:08,838 --> 00:01:11,668 Here in the aptly named dependencies section, 22 00:01:11,668 --> 00:01:16,560 we can add two lines to bring in Picasso and Retrofit to our project. 23 00:01:16,560 --> 00:01:19,810 Compile statements start with the word compile, then contain a string, 24 00:01:19,810 --> 00:01:21,350 and it has three parts. 25 00:01:21,350 --> 00:01:23,540 The first part is the project name. 26 00:01:23,540 --> 00:01:25,840 The second part is the specific library we want. 27 00:01:25,840 --> 00:01:28,240 This is sometimes referred to as the artifact. 28 00:01:28,240 --> 00:01:31,566 The final part is the version of the artifact that we want. 29 00:01:31,566 --> 00:01:34,626 The latest version can be found by checking the place where the code is 30 00:01:34,626 --> 00:01:35,890 posted online. 31 00:01:35,890 --> 00:01:38,650 I've provided links to these two projects in the teacher's 32 00:01:38,650 --> 00:01:41,220 notes to make sure you grab the latest version. 33 00:01:41,220 --> 00:01:44,526 Let's go ahead and add in new dependencies for Picasso. 34 00:01:44,526 --> 00:01:50,581 [SOUND] We're gonna use com.squareup.picasso, 35 00:01:50,581 --> 00:01:54,522 and the artifact is Picasso, and 36 00:01:54,522 --> 00:01:59,039 the version right now is 2.5.0. 37 00:01:59,039 --> 00:02:05,096 And for Retrofit, also from Square, 38 00:02:05,096 --> 00:02:10,024 [SOUND] version is 1.9.0. 39 00:02:10,024 --> 00:02:13,404 And again, every time that we change our build.gradle file, 40 00:02:13,404 --> 00:02:15,970 we're going to have to go ahead and sync again. 41 00:02:15,970 --> 00:02:17,270 So let's click Sync Now. 42 00:02:17,270 --> 00:02:20,120 Now that our sync is done, 43 00:02:20,120 --> 00:02:22,980 we can use the code in these libraries that we've just added. 44 00:02:22,980 --> 00:02:25,730 We'll get to that in a bit, but let's take a short break and 45 00:02:25,730 --> 00:02:28,910 then we'll add a few more classes to our project to help us model our data.