Android App - From Beginner to Published on Google Play ✅ | Grant Klimaytys | Skillshare

Android App - From Beginner to Published on Google Play ✅

Grant Klimaytys, Software Engineer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
41 Lessons (5h 18m)
    • 1. Introduction and what you will learn

      2:49
    • 2. Installing Android Studio and creating your first project

      8:46
    • 3. A quick tour of the Android studio interface

      7:31
    • 4. Why the need for beautiful Android apps?

      5:44
    • 5. What exactly is beautiful?

      5:28
    • 6. Blasphemy. Using Apples app guidelines for Android apps.

      6:42
    • 7. Designing our UX

      4:59
    • 8. Testing our current user interface in the Android Simulator

      6:00
    • 9. Designing the main screen layout in Android XML

      18:53
    • 10. Designing the add feed layout in Android XML

      9:03
    • 11. Designing the edit feeds screen in Android XML

      5:49
    • 12. Setting our app theme in the styles.xml file and Android manifest

      9:29
    • 13. Connecting up our activities using intents

      7:52
    • 14. How to set up an SQLite database in an Android app

      19:12
    • 15. Java code to store and get information from an SQLite database

      15:02
    • 16. Storing our RSS feed in the SQLite database

      15:14
    • 17. Setting up a ListView adapter for a list of RSS feeds

      14:35
    • 18. Editing a ListView and removing elements

      15:10
    • 19. Android app permissions (accessing the internet in our app via manifest.xml)

      2:51
    • 20. Creating our RSS Feed Item class to use with the library

      8:04
    • 21. Installing a library within an Android project

      6:31
    • 22. Fetching the RSS feed items from the internet (and our first bug)

      10:12
    • 23. Fixing our RSS library bug using 'try' catch'

      7:31
    • 24. Placing the collected feed items into our list view using an adapter on Android

      15:45
    • 25. Making our list look good

      9:01
    • 26. Creating our RSS item viewer using a web view

      11:19
    • 27. General monetisation strategies on Android

      6:00
    • 28. Getting paid via Google Ads (AdMob) on the web view page

      11:47
    • 29. Test, test and test again!

      4:22
    • 30. How to create an Android app icon

      8:47
    • 31. How to sign an Android app for release

      6:42
    • 32. Creating a Google Developer account for Android

      1:59
    • 33. Setting up a basic Android app Google Play listing

      6:09
    • 34. Required icons and Feature graphics for the Google Play Store

      3:53
    • 35. Android app screenshots for the Google Play listing (aka, free marketing)

      6:46
    • 36. Easy Task - Validate feed name

      0:18
    • 37. Intermediate task - Validate RSS address

      0:58
    • 38. Intermediate Task - Arrange RSS Items by published date

      1:38
    • 39. Hard task - Create GUI to choose individual feed stories

      1:19
    • 40. Hard task - Check internet before getting feeds

      1:08
    • 41. What you have learnt and where to go next

      6:49
32 students are watching this class

About This Class

Have you ever thought, "I can't program" ?

I once thought that but I tried making Android Apps anyway. Turns out it was pretty easy and after a few months I became self employed as an App Developer, ramping up my earnings to the tune of $120,000 per year. 

Would that amount of money change your life?

Well this Android course is where it starts, but only if you click the ENROLL button. Give it a try, you have nothing to lose and everything to gain!

f1ce7cf3

Transcripts

1. Introduction and what you will learn: Hi, my name's Grant, and in this course I'm going to teach you how to make beautiful Android APS. Now. Traditionally, we only see beautiful laps on the Apple App store, and that's a shame, because ever since Android five and six and the upcoming seven, we've had the opportunity to make really good looking app on Android. And so, in this course I'm going to teach you Ah, whole lot of things. We're going to start by stealing some ideas from Apple and using them for Android APS. Because Apple is very good at defining usability. Then we're going to code ourselves on RSS out. So I'm going to walk you through all of the fundamental code ideas that we have in Android things like list views or new activities, passing data between activities, getting information from the Internet and a whole bunch of other things. We're also going to look at monetization and your options as a developer to make money from your APS. I have one client that makes around £200 per day to the Americans. That's $350 per day just from advertising. So I'm going to show you how to implement those ads into your app. Then we're going to look at becoming a Google developer, listing our app on the Google play store and how to take full advantage of all of the screenshots and images we have on the play store because, in essence, those are free marketing for us. So this course is going to give you as the beginner two fundamental things, the first of which is how to create a good looking app. We're also going to steal some ideas from photography for that. Secondly, we're going to walk you through the entire process from start to finish, from installing Android studio to publishing your app. I'm going to leave nothing out because of all the courses I've seen, they all tend to concentrate on just doing the code part of the app. But the APP business is so much more than that, the coding is probably 30 to 50% maximum. So I'm taking you through everything and every complicated concept we come across. I'm going to explain it very simply, using Lego illustrations because I find Lego is very easy to learn from, because a picture is worth 1000 words. So I look forward to working with you on this project 2. Installing Android Studio and creating your first project: All right, let's install Android Studio, and you first have to come to develop her dot android dot com. And once you're in there, you'll get a Link 200 studio, and when you hit download, you'll have to agree to some terms and conditions. And once you've done that, it'll download it and refer you to some instructions. Now it's important to note that before you set up Android studio, you install the J. D. K. And to install a J. D. K. They provide a link here. When you hit it, it takes you over toe oracle and scroll down, and you want this top one here, the Job Baresi Development kit and you need to download the appropriate one for your operating system. Now you can run Android Studio on Lenox, Mac and Windows. I'm running it on a Mac, but it doesn't matter what platform you run it on. It's always going to look the same. And once you've downloaded everything, simply come over to your downloads, install the J. D. K first and then install your android studio. An android studio may request to download various other bits and pieces, so go ahead and agree to that on. Once you've done that, eject those images, close it up and fire up your android studio. And the very first screen you're going to see is this quick start guide where it gives you various options. Teoh starting your project or import various projects and settings. So for us, we're just going to start a new Android studio project. And if we click that, it asks us for some basic information. So here we have an application, then it's requesting. So let's write personal RSS feed, and then it needs a company domain. Now, this is going to be a unique identifier for your company or you yourself as they develop and you come down here under package name. It created automatically and puts com dot example dot grant. So this is put backwards down here com dot example dot grant doctor Personal RSS feed. Now in the android world, this needs to be unique, absolutely unique. If it isn't, you won't get your app published on the play store and the reason for that? Well, there are several reasons, but the primary of which is if Android needs to update your application or talk to your application from another application. It's going to use this package handle, so create your company domain. So my one is actually G K Micro. That's my company. And I'm just going to remove ground from the beginning. And I'm going to have com dot g k micro dot personal RSS feed and then finally put it in a project location. So I'm going to put this in the folder that I allocated to this project on the U to me courses. Click OK and 1st 0 yeah, we have a problem. It says Project location should not contain white space, as this can cause problems with the indicate ALS. And that's because I've got some spaces here. And worse, I've got some brackets and modern operating systems can handle those Fine, but sometimes older ones like Java and things cannot. So let's just put this straight into our documents, and that should be fine. And then we click next. It takes us onto the form factors that we need for a project, and it says you want to run this on a phone and tablet android wear android TV on Android auto. Highly unlikely you're going to Android Auto. You might do TV on. There's a lower chance of doing where, but for now, we're going to do just phone and tablet, and it asks you for a minimum sdk. And if you click this box down, we have a whole range of SD case. And in the android world, when they refer Teoh an Appy number so happy one all way too happy 23. It actually refers to these releases off Android. So happy 15 is Android 4.3 And if you choose that as a minimum, you'll target probably about 85 to 95% off devices out there. You don't really want to go back any further than this for compatibility reasons, because you're going to have to make a lot of compromises on what you can and can't do. So for now, on the date is November in 2015 I would say Go with Android 4.3 and there's a very handy way to see which minimum level you should go for. If you go to places like android central dot com, you can see here it gives you a breakdown off devices by version. And if we start on 4.3, we have 3.7% and then it rises through the various other operating systems. So this is a very handy way just to have a quick glance to see how many devices you'll actually be able to run on. So over here on the pie chart, we have froyo and gingerbread that have a minimal market share about 5% and the rest off them will be able to run your app so hit next and then it asks you to add an activity to mobile. And an activity is simply a single screen in Europe that is presented to a user, so it's not really focused around the screen per se. It's more something that takes care off a set of actions that are happening in your app. Now for our project. We're going to choose one of these options, and there are many that you can choose from a blank and empty full screen. Add more bads, but we're going to make our own ads inside our app later on. Master Detail Navigation drawer. This is probably one that you're going to use quite often in your android development, but we're not going to use it here today. We're going to have a very simple app, which is going to start with a blank activity. So click next and then it asks you for an activity name and we're going to leave this as main activity, and you should name your primary activity as the main activity. Then it asks for a layout name in the android world. Both the activities and layouts are separated in code. Layouts are done in XML, and that's why it asks for a layout name. Finally, the title can be anything you like. So let's put this title as news feed, and then it asks for our menu resource name, and we will leave that as men humane. There's also an option here to use a fragment on where they're going to cover fragments in any great detail in this course. But you will use them again quite often in your android career. On a fragment is just sort of a subset off of you, so it's a view you can insert in an activity. You can then remove it from the activity and insert a different view, and it's just a handy way off making your code more modular. But for now, let's leave it unchecked. Click finish. And it will load up your project for you. Right? All the files that you need for it. Andi, it will open up your project once that is done. Once that's done, your project opens up. And in the next lecture, I'm going to go through what most of these windows inside this screen are all about. For now, it looks complicated and scary, but it really isn't. It actually makes our life so much easier than the days when Android APS were written in a clip studio. So join me in the next lecture. 3. A quick tour of the Android studio interface: So we've opened up our Android project and represented with this screen in Android Studio on Android Studio actually uses in Telly J as its base platform on For years, most developers used in Tell Ajay instead of the official Eclipse version, because it's much easier to work with. And at first this looks very complicated, but it isn't. I'm just going to go through one or two things you need to know. The 1st 1 is on the left hand side. Here we have an app, manifests, Java rez, etcetera and grateful scripts. Now, if you recall when we created our up, we gave it a name. And if you click manifests and you open android manifest dot xml, you can see here we have a label called Personal RSS Feed, and this is under a tree called Application and that allows us to label the application itself. So this is the name that will be shown on the icon, etcetera, etcetera. Now you'll notice as soon as I clicked it, the label changed to this at string slash AP underscore name, And that's because it's a good practice to store all of our labels and strings and various text elements inside a file called Strings. And the reason we do that in Android is so if we want Teoh localize our app so translated to French or German or whatever, we can simply change that inside the strings file. And we don't have to go through various sections here or have if statements in our main program, it does it all automatically for us. So if we find this string file, we can find it by coming over to the left hand side here. And if we click values down, we have a string start XML file. And if I open that you'll see in here we have app name, personal RSS feed. So you can see how in here we could change the locale setting and we could have won. That was for German, for French, etcetera, etcetera and the app would change everything automatically for us. So I'll just close that coming back to our manifest. We also declare on activity, which is our main activity. And again, this has the label off the APP name and it has a theme, which is that theme, Doc? No Action bar and I'll go into all of these much later on. So let's close that moving on. If we go down past manifests and we open up Java, we have two folders here. The 1st 1 is the one we're interested in, and it contains this main activity dot java file. And if I open that, this is the first code that's automatic, automatically created by Android Studio for us. And so when we run this, it's simply going to show us that screen that it showed us in the project set up. Most of your code is going to be here in Java. In fact, all of it, I would say, next folder we have is rez and reds stands for Resource Is and resource is are all of the draw herbal things. So your images etcetera your layouts, which define how your screens look, what kind of buttons you haven't there or list views, that kind of thing. You have a menu folder that allows you to inflate menus. I wouldn't worry about the MIT Matt folder for now, and the Values folder, which will beam through to store your strings and colors and styles for Europe. So on this left hand side, if I just minimize everything. Rez basically stores all of the user interface elements of Europe. There is no programming that goes in here. The programming goes in the Java folder off our. So that's important to remember for Android because I us conduce it both ways and slightly differently. The next window we have is here under palette, and we have various things that we can add into this content dot xml. So if I wanted to, I could drag a radio button in, and it would drop it in for us wherever I've put it, And again, we'll go into that later on. So this tab is where you put all of your U Y. Elements. You can also switch to text down at the bottom here, and that shows you the XML that's happening behind the scenes inside your user interface. And this is where it all is in Android. This is where you design everything, so you're going to place things into here. So if I put a radio button in, I can click the radio button. I can come over to the right hand side, two properties and I can change various things in here, but I can also come down to text, and I can change the properties in here by directly editing them. And typically you're going to do a mix off the to. So just remove that. Okay, Over here on the right hand side, we have our component tree, and this just shows us a summary off the various elements we have in our app. So if we click text again, you have relatively out. And then underneath that we have text view, click design, and it shows you that there. So it's just a quick reference, really. That is pretty much all you need to know when you start building your android APs. So that covers the user interface. Of course, we have a whole bunch of menus and we have these menus short cuts at the top here. But I'll get into those as we start to build our up. There's no point in going over it now if you're not going to use it yet. So in the next section, we're going to cover what makes a beautiful app and in particular why we want a beautiful lap. And this next section is where the fun really starts because we're going to actually create something. We're not simply going to program and code in this course because let's face it, coding is somewhat boring. And if you're like me, you like to see things you like to feel your creations. And that also is part of the reason I use Lego to demonstrate some programming concepts because it's much easier to understand from things that we can see and that we already understand, so I look forward to seeing you then. 4. Why the need for beautiful Android apps?: So why, Oh, why would we need a beautiful out? Well, it's simple. Humans like to look at pretty things. If we see a pretty girl walking down the street, we stare. If women see a pretty looking man walking down the street a little bit muscly, they stare, and it's no different in the APP world. So I've just pulled out the Google play store of my browser here, and I'm glancing at all of these icons because the icon is the very, very first thing your users will see. They will also decide whether or not they're going to look at your APP description based on the icon and the title, but mostly the icon. So the word iconic iconic design. That kind of thing has the word icon in it, surprisingly enough. And if you want your app to be downloaded, your icon has to be iconic. It has to be recognizable, and it has to scream it the user exactly what your app does now scrolling down here. This catches my eye first, YouTube kids, because it's recognizable as the YouTube logo, but it's kind of made cartoony, implying that it is for a younger audience So that is a very good example off a good icon coming across. Some brands, like Pinterest and Vice News simply put their logo up because it's that well known. Same with eBay on Netflix, other ones that you might not have heard off like ran tastic show a running man, which tells you everything you need to know. Now I'm just going to show you what the difference is between a mediocre rap, a good app and a beautiful lap. I've got three weather APS open, the first of which is from the Met office in the UK, and now the Met office is the place that provides whether information toe all the other APs so you'd think they'd have the best looking application. But you can see immediately. It's not that great. There are too many colors going on. Too many primary colors as a lot of gray and gray is not a great color to use for a nap, especially a weather app. You can use gray if it's cloudy and gray. What if it's sunny? Well, I don't want to see gray. It doesn't stir up. My emotions and emotions are important because emotions are what control whether someone downloads your app. So if we move to the BBC weather app, we can see an improvement already immediately. We get the information. We need a location, a date, whether it's sunny or not and what temperature it's going to be during the day. And that tells me everything I need to know. I could just glance at that and I know where I stand. But let's go one further. Let's go to Yahoo Weather and now we're talking. Now I have an image to look at on my eyes, immediately drawn in to this picture. It's very minimal. It tells me the information I need to know, but it also gives me a picture off the location, which is one step up from the BBC weather app. And so what's the true cost off? Not having a beautiful lamp. Well, let's go back to Met office and the number reviews we have is 14,000. The BBC weather 151,000 Yahoo weather almost a 1,000,000 reviews. So when you're downloading an app, it's these screens that make up your mind for you as to which one you're going to download and that ladies and gentlemen, is why you need a good looking app. So people download it first and foremost in your android design. It is the beauty off the app. Forget about the coding. When you first fire it up, we can cover that much later. People will forgive a slightly buggy yet beautiful lap because they will have downloaded it already and they'll have an emotional investment in it. They will not download a beautifully functioning up, but an ugly one. And so, no matter how well your code, how good your code is, they won't care because they don't have your app. So in this course we are heavily leaning towards making something that immediately jumps out in the app store at people browsing for a news. Feed her up in the next lecture. I'm going to go over. What exactly makes a beautiful app? I mean, why exactly is this more beautiful than this? More beautiful than that? I've covered a few, but I just like to take a few minutes and really get it nailed down for you. 5. What exactly is beautiful?: all right, so let's look it. What exactly is a beautiful lap? Because when we look at something, we can know this is a beautiful lap or this is a rubber shop, and a good place to start is in the photography world, because photography has a couple of rules about composition, often image. And if you follow these rules, you'll come out with very good photographs. Of course, you can break these rules as long as you break them in a good looking way. So let's run through these. The 1st 1 and ugly, arguably the most famous, is the rule of thirds. So you divide your image into nine sections. So lots of three on the horizontal and vertical and you place your subject on an intersection somewhere, and that makes for a very good looking image. It's very interesting, and it draws your eye in to the main subject so we can apply this in our laps as well. The next one is balancing elements, so it basically talks about balancing the weight of your subject by including something else that doesn't feel quite as important inside your image. And this is exactly what Yahoo Weather has done here, So 19 degrees. If I'm holding a phone in my hand, 19 degrees would be the thing that my eye gets drawn to first and that is balanced out by this image in the background. So that's using this balancing rope. The next one we can use is one called Leading Lines, which takes your eye through the photo following this road. And if we're looking at various APS, the BBC, where the rap does this in a way at the bottom because you go today, Thursday, Friday and you naturally know that this carries on outside here in the same way as this road carries on up here. Of course, we can do symmetry and patterns in APS. We can change perspective, but that's an advanced topic that we're not going to cover. We can give our wrap a decent background. So in the Met office up the background is this dark gray black color, which is kind of the same is the foreground, and that doesn't really work. If I go to this page off some beautiful laps, you'll notice that here, for example, investment, the background is just a plain color, and that makes the foreground pop. It highlights the content you want to work on, and this works two ways. We can have a background off, a nice color and a foreground of a neutral color. But again that makes the content. Pop depth is something that Android is getting better at. But I ask, Does it much better than Android ever since Android Lollipop? If we look at this mayor like on here, it implies a depth because we have a small drop shadow to it. So that tells you intuitively, that it's a button. Framing is all about what puts what things you put around your subject. So without the frame, this floating log wouldn't look very interesting. Cropping is a great technique for your raps, because often you're going to have images you want to display. But if you show a full image at two smaller size, it won't mean anything to people. But if you zoom right in and you slowly pan that image, it attracts people's attention and it's a very, very powerful way to get someone's attention on a particular point off your app. So we're going to use something like this in our app later on and Of course, you can feel free to experiment in your app. You can change the composition, change things around, and there's no set rule for compositions in Europe. It's whatever you think looks good. So in this course, I'm going to give you some basic pointers, but I really want you to experiment with what I'm giving you In the next lecture. We're going to discuss why Apple maps look so much better than Android APS, at least in the past five years or so, since APS have exploded. And that's because Apple have a set of guidelines for developers, and what we're against do is akin to blasphemy. We're going to use the Apple guidelines to design our android app, so join me in that lecture. 6. Blasphemy. Using Apples app guidelines for Android apps.: okay. It's probably very weird seeing a screen about Apple. I asked Design in an android course, but there's a good reason for that. And that's because Apple have put a lot of time and effort into actually designing I us well on to communicate all of that effort to us. They have a free document called the I US Human Interface Guidelines, and these aren't rules. As the name suggests, there simply guidelines that help us design APS. If we come down to the menu on the left hand side, we can see there are various things we can scroll through, like designing the anatomy of a nap at activity and layout, starting and stopping, branding, color and typography, etcetera, etcetera. And I advise you to read this document over the course of a week and really get familiar with it, because it's really going to help your app shine and I'll just go through two or three points here, the first of which is deference on. In my opinion, this is king in any up or any software or any website. Deference is simply a statement that says the user interface allows people to understand and interact with content, but it must never, ever compete with it. So in this screen they have down here, which is again, another weather app. We want to know the temperature, and there it is. Nothing is interfering with that. Nothing's covering that. I don't have to click anything to get that information. Next is clarity. When I opened my app, I want to know within 0.2 seconds the information I'm looking for. And if I have fuzzy images or fuzzy text that's not going to happen. That will lead to UN installs off your app. Finally, depth gives people an extra element of understanding a three dimensional element. So if we come back to the Android studio, we've got open. We can see this mail button down here has depth because of this shadow, and that immediately tells us it's a button. No one has to write button on it or anything like that. We just know that is something we can press. And so carrying on on the basic interface guidelines, you should always defer to content. So here there are actually two competing contents in this image, the first of which is the temperature, the next of which is the fact that's gonna be a thunderstorm. And so in this case, I'm actually getting to bits of information. And these two bits of information invoke an emotional reaction. And when you do that, you draw your users in to Europe. If you don't evoke an emotion, then they're not going to be bothered about Europe. If they get a new device, they might not reinstall your app. Okay, It says here sometimes you should go for more of a flat design and put less shadows and things in. And I ask from version 0 to 6 had lots of shadows and depth to it. And in version seven, they made a massive changed and made everything flat on Android has somewhat joined them in that quest. So only use shadows when you want toe imply that you're going to press something or you want something to come to the foreground. Okay, I won't carry on going through this document because, of course, you can read it in your own time. But you can see already how it has laid out how people interact with small screens. Things need to be clear, and people need to get the information they need straight away. Now, I know I've been talking about Apple design guidelines, but ever since Android 5.0, Google have come up with their own version off design and they named it Material Design. And it was the first time they ever actually had some kind of guidelines for developers. And this is a very good thing, because now android APS can finally start to catch up to the quality off apple apps. If you jump onto Google and search for material design, the very first link you open will be this document. And it tells you what the Google design material design principles are, and it uses a metaphor off material. So everything feels kind of riel and tactile. Everything is also very intentional. So if we come back to our app, this button with the mail on it is intentional. It looks like you should press it. It also discusses animations and motions. And as a developer, you have to be very careful here. You should never, ever overdo animations. And that's something both Apple and Google agree on. I'm not going to go through the rest of this document because they cover all of the various ideas. But in my opinion, the Apple document is actually better than the Google one, because Google is currently playing catch up. So in the next section, we're actually going to design first of all, our user experience. Now the user experience is different from the user interface. User experience simply informs how are APS going to flow from screen to screen once we have that, then we can dive into this design element, and for that design, we're going to use these interface guidelines, so join me in the next lecture. 7. Designing our UX: Okay, Welcome to this section on our user experience. Now, you may have heard the term user experience and use the interface all mixed up in one sentence, but they are not the same thing. Generally, you do design them both at the same time because they are intertwined. But they're definitely not the same thing. The user experience is how your user interacts with your app at a starting level. Andi at unending level. It's how your user feels about your rap and the emotions that Europe might invoke your user experience. Design starts very simply with a bunch of screens and the link between those screens on the best tool for doing this is a pen and paper. Believe it or not, there are online tools and downloadable free tools, but they all take time to learn. If you're going to make a complex app, then by all means use these tools. But for now, grab a sheet of paper and a few pens and design the app, and that's exactly what I've done here. So I've started with the main screen that has my RSS Barak across the top there. It has a settings icon at the top on a list off current news items. Finally, I have a plus button at the bottom that's going to allow me to add more feeds. So starting from the top, we design in our user experience, and the 1st 1 is this settings button, which isn't that well drawn, I'll admit. And if we follow this arrow, it comes up to our edit feeds button, and this screen is going to have a list off the feeds we're currently subscribe to, and it's going to allow us to remove those feeds from our data. Then we have a list off news items that are extracted from those feeds. And when we tap on one of these sections, one of these cells, it's going to open up a new activity or a fragment that gives us the title of the new story at the top, perhaps an image if one is included, and the actual news story below that. And finally, this plus button will allow us to add another RSS feed, and it will open up this screen, which is the ad, which is simply on address box with an ad button. You'll notice in all three of these screens. We have a back button, and that's is also part of the user experience. Nowadays, uses expect to have a back button or a close button or a go back button, something like that. It makes it really obvious where they have to go next once they're done on this screen. Now, if you prefer to use online tools, then I can highly recommend one called Picks eight and picks eight used to be charged a fee for, but now it's been purchased by Google and is completely free and in picks. Eight. You can design for both Android and Apple. So it's not a problem that Google owns it because they still allow you to design for everything. And the beauty of Picks eight is that it gives you a really functioning prototype. And if you're doing freelance work, that is something that is priceless. If you can put a functioning prototype into someone's hands within a week, they are far more likely to purchase whatever services your offering. Okay, in the next section, we're going to move on to our user interface. Now, this is going to be the design section off our APP. Normally, we'd use something like picks eight or photo shop or even sketches on a piece of paper toe actually design our app, and we would do that when our app. It's very complicated and has lots of screens, and we would also do it when we have a very large team to work with. But in our case, we are a soul developer. We have a nap with just four screens, so we can just go straight into Android Studio and begin and begin designing our APP interface directly in there. So in the next section, we're going to look at developing those user interfaces within Android Studio. 8. Testing our current user interface in the Android Simulator: Okay, let's return to our opened project inside Android Studio, and the first thing you want to do is make sure that it'll runs. So it's just running the default program. For now. If we come up to this top bar, we have various options. We have one up here, which is play, and we have one next to it called Debug. We want the debug option because that will allow us to communicate with the app that's currently running and allow us to discover various errors that might happen and then to fix those errors. So click that debug button and it will ask you to choose a device. At the moment, there is no device running. I have some options here, but these are installed with my other development software called Samrin, and they will not work with this app. You will unlikely have anything in this box, so click the three dots next to it, and it will open up your virtual devices interface down in the bottom left corner hit create virtual device and you can choose from a whole host of devices. Let's go with the Nexus five. Click next. Then it will ask you what image you want to put on your nexus five. Onda. We are targeting an Appy level off 15 and higher, so ice cream sandwich and highly. I think we should target Lollipop because within a few months that is going to be a very popular operating system on Google, and you'll notice there are various versions you can download X 86 64 etcetera, etcetera. At this point in time, it doesn't really matter which one you install on your computer. You probably want X 86 because your PC will have an X 86 processor. If you have a 64 bit process, ER, then you can have the 64 bit version off lollypop over on the right hand side, it says. Install this for better emulation performance. Well, let's click that. Let's click next and has asked me to put my password in like so I'd advise you install this performance accelerator because the android emulator is dreadfully slow. It is light years behind the Apple version and also light years behind, actually just running it on a device once that's done, hit, finish and then come over and download the appropriate lollypop image You can, of course, have more than one emulator and more than one image on any number of devices. You're only limited by the amount of space that you have once that's done, hit, finish and then hit next and it's going to create your device, so just leave it as happy. 22. It'll ask you what scale you need. Portrait landscape. I'd advise you just to use the default settings. It finished, and it will save your AIVD, which stands for Android Virtual device. And there it is. Okay, close that window. And now it will appear in your options. Here, select the Nexus five hit. Okay. And that should build it. However, we have a no pointer exception here in our event log, which is down on the right hand side. And that is because we haven't quite finished setting up our development environment yet. We have to perform a few more steps and you'll find these in the top menu under tools. Android sdk manager. Now you can use Android studios new version, but I find sometimes it hangs so down here you have the option to launch the standalone sdk manager. Go ahead and click that once that launches, you're presented with a whole bunch of options to install various modules to develop on Android. So we already have six. So let's uncheck all of that and then down here because our device is running happy 22 We want the STK platform for that. And down here we would also like the Android support library hits installed two packages except all of the licenses and wait for that to download. Once that's done downloading close your STK manager, come over to Android Studio Andi, just cancel that hit Debug it the tongue come down to launch emulator and fire up your immolated I've already got it running in the background so I'm going to fire up my app on it There, I'm gonna hit okay and it will load up the emulator And there we have our up as it currently stands 9. Designing the main screen layout in Android XML: So let's look at building out this main page. First of all right, the very first thing we need to do an android studio is sort out the layout of our main screen. So at the minute we have content Main open. Let's open activity Main XML and in activity Main, we can see a tree layout of XML that goes through all of the support widgets, like at a bar and Touba Touba refers to the top element and in here I want you to pay close attention to this line. It says include layout equals layout content main. Now that is there because it is going and looking inside our layout folder and finding the file called Content Main, which is here and then including it within our layout. So if we want to change anything inside this white area, we need to change it in content main. So if I go over to content main, I can click Hello world and I can change it. And if I changed it to something else Hello, world. Whatever. When I come back to Activity Main, that has now changed because it has referenced that content main file. The other thing I want to draw your attention to is this floating action button here. This is the first thing we're going to change. We can leave the I D as fab. That's fine. We can leave the width and the height and the gravity. We can leave the margins. However, we need to change this icon here at the minute it's set to at on Drugged Roble Icy Dialogue , email. Now this is referencing the standard android resource is folder, and in some cases this can actually be somewhat often error. Because if you get on a device that doesn't include these, then your APP will be in trouble and it will crash and not work. So it's always best to download your icons from the Internet or create your own and then include them in the yet. So let's go ahead and change that icon. Now you have a few options here. You can use a graphical program to create your icon like photo shop. You can download your icons from the Internet, or you can download them from the standard android resource is, And if you go hunting on the Google Developer website, you can find those without much trouble myself. I like to use photo shop, and I've just got a little 100 pixel by 100 pixel image created here with a plus icon in the middle. I have no background, so it is transparent, and I'm going to color the icon white because that's the color, um, after, go ahead and save that as a PNG and give it an appropriate name like add icon. And once it saved, pull up the folder that it's located in right, Click the icon, click copy and paste into draw herbal. Okay, now we have to assign that image to this source for the floating action button. So delete the android section there to leave at a drop ball forward slash and then replace . I see dialogue email with Add Icahn and you'll see on the right hand side. It has now appeared, so that takes care of the button. Now we need to add a list because this is our main screen that will old our stories. To do that, we have to change what's included here under this layout Content main. So click on content main dot xml. Click on Hello World and delete that. And if you double check inside the text version. You'll see. All we have left is a relative layout, so click on the design tab. The next thing we need to add is a list of all of the RSS feed items that we collect from our RSS feeds. So in the left hand pain here, let's scroll down and find an element called a list view. Now if you hover over it, it says this shows items in a vertically scrolling list, which come from a list. Adapt to class. Drag that onto your screen, and it gives you an example of what this may look like. Click on text and in list view. We want to set our width and our height to match parents, so start typing match and it will auto complete for you. Now click on design and you'll notice that it is placed it as an item that fills the screen . And that's exactly what Match parent does. It feels the remaining space on the screen. You'll also notice there is some margins or padding around the size here, and if you click on your text version, you'll notice in relative layout. You have these pad ings set over here for 16 dp on each side. So, for example, if I click it, it tells me these pad ings are contained in diamond diamonds dot xml under activity, horizontal margin. If I come over to values and I open up diamonds, the XML, I have all of these margins here. Now it's up to you if you want to keep margins or not, depending on the look of your app, you may want to do away with margins if you want something that crosses over the edges of the screen of Europe. And that could be a good case for when you have items that are scrolling horizontally because it informs your user that if something is partially hidden, they should try to scroll across to get to those new items. That is a very good way of introducing usability without having to explicitly tell your user that some things that so let's close diamonds and let's leave that as it is, save everything and let's change the I d off this list view because if we just set it as list view later on in our program, when we search for it, we might come up on a different list view. And if we have two that are named, the same program will crash. So let's call this RSS feed item list if you you'll notice. I've put a small are and then capitals for the other words. This is called camel casing, and it's a common convention that we use inside programming. Mostly see sharp, actually. But in Java to if you want to read more about that, simply search for camel casing. That's camel like the animal on Google. Okay, once you've got that idea in there, let's save that. Now that we've done that, we need to create the rose that go in each item off our list view. And to do that, come over to lay out right Click new XML Layout XML file, and now we have to give this a name. So let's call this RSS feed item row, and we have to give it a route tag. Now there are two that you're going to come across. Generally, one is a relatively out one is a linear layout. Linear layout stacks items, one on top of each other, so it puts them in order that you add them to it. A relative layout simply stacks them wherever you say you want them stacked so it overlays them on top of each other. It doesn't particularly care where the margins or the borders over any elements are. So for this, we're going to use a relative layout because we may want to stack things one on top off another. So that's saying relative layout, and it says my layout file name is not a valid name. That's probably because I have capitals in it. So let's call this RSS feed item rope. Here we go. That works fine now and click finish now. One thing I haven't mentioned is that when your APP is referencing these layout files, it tries to find these names. These names are a unique I D. So you cannot have two files that are named the same. Okay, this row that we've created is going to show us each item of news, and as such, we might have an image we want to display in that news item. So let's click on design and from our widget section. Let's get an image view and drag it onto the screen. Then let's change to text and look at the values that it gives us. First we have a width and the height which are wrapped content wrap content means that it's simply going to size itself to the size of the image we provide it with. However, we want a fixed height Ferraro. And if we leave it set as this, then that height is going to be variable on. Our won't look very good, so we need to set our height as match parent. We can leave the width as it is for now. We might have to come back to that later. Let's give this an I D. Let's call this RSS feed item image view and it asks us, Do we want to align it to the parent top? I think we'll leave. That is yes. Align. It's the left. Yes, Onda, we want any margins. Well, we don't really need margins at this point, so we can delete all of these margins and add the BAP later if necessary. Now we need to add a source for our image view, and I've got an image I've prepared and the reason we need to add a source now and not later on when we get our feeds is because we might not have an image in those feeds to display. So I'm going to drag and drop an image into draw herbal. And it's one I've created called Extra Image. Just show it to you and we get So it's basically that if I put a white background in, we have that and this is going to be our default image. If the RSS feed doesn't provide one, okay, let's assign that image to this image view as a default. So, as before, I'm going to right click my image and click Copy, and then I'm going to paste it into drop ball here and leave it as name extra image and thats click on design and in the properties panel. Let's scroll down to source and hit the three dots on the side, and it will say, Do you have a project resource you want to put in and we do, And let's scroll down and find extra image. You have some styles scroll back up to the top and we just want draw herbal. There it is extra image and click OK, and now it's put it in for us But of course, we again have a problem that the aspect ratio is wrong because I have a square image. But this image view is taking up the whole parent. This won't necessarily be a problem when we run our list view, but just to make sure we're going to come to the text version and we're going to explicitly set the height in our relative layout. So let's set this height as, let's say, 80 dp, and they used to see everything has bean realigned. Now, if we set the height as 80 we should also set the width of our image view as 80 and that will give us a square image right up in the top left corner off our road. And that's perfect. That's just what we want. Switchbacks designed view, and if you like, you can add some margins and padding to this, but it would advise us to leave it as it is for now. The next thing we have to add is the title of our RSS feed item. So here we have a medium text. Actually, let's choose a plain text view and drag that onto our view, and if you double click it. We will set the text of it as title text. Have you? Just so we have something to look at and we can also set the idea of it directly in the designer and we will call this All right, says feed item title text view. Okay, so that's how title text set up. Now it's optional here. You can put a little description text under that if you wish, and that's what we're going to do. So click on small text and drag it directly under title text, and then just simply type for some garbage. So you have something to look at. Let's give it a name and say RSS feed item description, text view like so and that sums up our road. This image, when we get an RSS feed item, may, of course, be replaced with the stock image contained in the feed. Okay, so we have now created our list view inside our main screen, and we've created the Rose that are going to go inside that list view on the main screen. Now I'm just going to run it. I'm going to launch my emulator, and I have a feeling we're going to get an error, and this is good practice to continually test your app. And it says down here error eyes, not a valid file based resource name character. File based resource names must contain only lower case numbers or underscores, and that's referring to my ad capital I icon and extra capital I image. So let's change those names. If you right, click the image and you scroll down to reveal in Finder or reveal and Windows Explorer, it'll open it up in a find a window for you. I'll just pull it up here. Then you simply need to change to a small I alternative. You can have underscored Icon and the same with extra image here. Then, when we scroll back to our app, that would have changed in here. And, of course, we have to change the references thes images. So in our road we should click the image. And if we scroll down to properties, this draw herbal extra image is now read because it doesn't exist anymore, and we need to find it again in our drawer bull folder, extra underscore image, and it's going to be the same for our plus button. We can see here. This has changed in our activity. Main underscore at icon. So say that. And now when we debug and run it, everything should compile. Fine. And it will show up on our device. Okay, Just for speed. I'm not actually going to show that. I just wanted to check that it built without any errors. So I'm going to shut down my device and stop the debugging here. Okay? We have now covered creating the main screen of Are at the Table and the RSS feed items. In the next lecture, we're going to look at designing the ad feed screen. So the screen that gets created when we click this plus button on our main screen, so join me for that lecture. 10. Designing the add feed layout in Android XML: Okay, let's create the ad screen off our APP. If you recall the ad screen of our app is the one that's going to get pulled up when we hit this ad floating action button down here on the right, so I'll just close that file now. When we create a new screen, we have some options. We can either create what's called a fragment, and I'd advise you to go and look on the Google Developer website at what fragments are or you can create an activity. Andan activity is something we already have. We have a main activity here, so let's create another one click on your com dot whatever you named your app, right click New Activity Blank activity. Now let's call this something obvious, like ad feed activity, and you'll see it creates a layout for you automatically gives the activity a title asks you if you want this to be a launcher activity or to use it as a fragment, we want neither, and then it asks you for a hierarchical parent. And when you click in that box, there's a tool tip that comes up down here that says the parent activity used to provide a default implementation for the up button, so it provides an implementation for navigating back to the previous activity. And in your drop down list, you should have your main activity listed. If you don't simply right your line that started with calm, followed by dot main activity, and that would be fine. Click finish, and it will create a bunch of files for you. The 1st 1 is add feed activity dot java. The next one is activity at feet or XML and content. Add feed dot xml. So let's open activity at Feed or XML, and you'll see it is very, very similar to the activity that we had opened before. Except now. This one also has a floating action button, which we clearly don't need. Donor adding an activity. So let's just go ahead and delete that section. It has an include to include our content. Add feed, which is this which at the moment contains nothing. Switch back to activity, add feed and save what you have there. Now let's go into add feed activity, duck java and make sure we don't have any errors in there because we deleted something. The first thing that pops up is this floating action button, and we've just removed that. So when your program starts, it's going to come along and try to find this button, and it won't be able to find it. So let's remove this and safe and close that file. Okay, now we can get on with actual design off this screen, so click design on content Add feed dot XML. And if you recall, we need two elements only on this screen we need a box that allows us to enter an RSS address and a button that allows us to save that RSS feed address. It's the first thing we're going to add is some sort of box that allows us to enter text, and there are a range off pre made ones that we have here in the text field section. We can have plain text, a name, a password and a password is a box that put stars or asterisks over the past week that you're entering so no one else around you can see it e mail, phone, etcetera, And if you have one of these particular ones, Android will configure the keyboard that pops up to suit them So a phone one it'll put over a number pound. We just want a simple plain text box. So let's drop that into our view that switch to text and we can see this is called an edit text. And in fact, all of these text fields would be edit texts. The first thing we have to do is change the i d. So we can find it later. So let's call this ad feed and it text, and then it asks us for some positioning. So the width at the moment is set to wrap content. Let's have that as match parent. So it goes the full whipped off the screen. We can leave the height as rap content. The idea we've set, it asked us, Do you want to align this to the parent top? We can leave. That is true for now, would relax to align it to the center horizontal. That's fine, too, And it says, Do you want to have a margin from the top? Well, let's decrease that a bit, because we may run this on a much smaller device or in landscape mode. So what happens if we put 20? It goes all the way to the top. Let's put a value like 60 which drops it down a little bit. Okay, say that. Go back to your design view and come up to the widget section and we can drag and drop a button into the view except go over to the text view. Let's give this and I d so at feed button lay out with Let's give this a fixed width off about 90 DP. That may not be enough because it is stuck to the words on top of each other. So let's give it 120 and leave the height as rap content. Although I should say at this point that you should listen to again the IAS human interface guidelines that will guide you through things like sizes of buttons and on a screen. You generally want that to be larger than 44 by 44 screen points. So let's just make this 44 dp high there we can see it. Let's give it some text, save feed, and that pretty much does it Now This also has a margin on it is set below the ad feed edit text, and we can change all that around if we want. So I generally like to have something a little bit closer se 34 dp And then I'm going to drop my edit text just a smidgen about that. So again, if you recall from earlier lessons we used photography rules to design our wraps, and in this up, I'm generally using the rule of thirds. So they say, Feed Button, I think could actually come up a little bit more. Let's say 28. So I'm placing this box on this button at the focal point off the rule of thirds off my current view. Okay, Save that and let's run it. So hit the debug icon. I already have my device running. I'm going to build it and send it over and see what it looks like. Okay, that's fired up. So if I hit the plus button, I get this replaced with your own action because we haven't set the new activity to come up yet, But we're going to cover that in the next section. For now, we're going to move on to the next tutorial and we're going to design the edit feeds, and that is going to pop up when we hit this button at the top here, which is currently set at settings, so join me for that way. 11. Designing the edit feeds screen in Android XML: Okay, let's add our customize RSS feeds screen. So let's close what we've got open here so we don't get confused. Right? Click on Java com dot etcetera. Etcetera. Go to new activity blank activity. And let's call this and IT RSS activity or edit RSS feed activity to make it a bit more obvious. And the parent of this activity is going to be main activity. Click finish, and it will open the content screen for activity, which is content Edit RSS Feed or XML. Now, inside this content screen, we need to have one element, and that is a list for you. And before we do that, let's rid ourselves off this email button that Android likes to put him for us and go to activity, edit RSS feed or XML, open it and simply removed the floating action. But then, to finish that off, go to edit RSS, feed activity dot Java and remove the floating action button reference there and save it. Now come back to your content Edit RSS feed or XML, and in here let's click design Let's drop in. I will list you scroll down and drag and drop a list view into the screen. Let's go into our text because I find it easier to read. Let's change our I D to edit RSS list view. Let's have the height as match parent and with as match parent, align it with the top is fine, Aliant with the horizontal center true and the layout at margin top, we will set to something small like 10 dp. Okay, say that now all that that needs is for us to specify what these rows are and the layout of them. So to do that, we can take a bit of a short cut. We can come down to lay out RSS feed item row. We can right click copy and then on layout, click paste and we can call it are Isis Edit Feed Item road like So now when you're going to copy and paste things like this in your android projects, you have to be very, very careful. The very first thing you have to do is change all of the I ds. So I'm going to do that here RSS edit feed item image view. And in fact, we probably don't need an image view for this road, and that is because it's just simply an address. So let's go ahead and delete that image view. Then we're going to have a text view called Title Text View here. We're going to actually change this to the RSS title, So title RCIs Feet. Then let's change the I D to RSS Edit Feed item title text view. It's a bit of a mouthful, but we'll get by. It isn't aligned to the right of anything or to the end of anything. So let's remove those two lines, then Our text view. This one was the one we used previously for the description, but way are going to name this something different. Let's have this as the Web address, whatever that happens to be. And let's change the i d to RSS edit feed address text view. In fact, I've made a slight error on the text. Few at the top. Let's change that I d and remove the word item because we have no items. We just have feeds in here. So our says edit feed title text view. Okay, then this text view needs to be placed below this text view so we can change it here below RSS feed In fact, if we copy this, I d. From the text view, we can just paste it in there and it should place it below, as we can see on the right side. Okay. And let's delete to write off and to end off at the moment, it doesn't look like anything special, but as I say in previous lessons were going to come to that part of our app. The important thing when you're making a nap is to start out with a proper functioning set off activities and fragments. You can always tweak things a little bit later, so save that and that concludes the construction off our edit RSS feed activity. 12. Setting our app theme in the styles.xml file and Android manifest: all right, let's set the theme and the main colors of our app and those are stored in the values under rez and in style Start XML. So if we go open that file, we can see we have a base application theme and this style has a name which is apt theme and a parent which is themed are apt compact dot lights, Dark Dark Action Bar and the reason it's inheriting from this theme, which is based on APP compatibility. If I open main activity dot Java, it's because our main activity extends app compact activity and you may wonder what all of this means. What? It simply means that when Android introduced all the new features in lollypop kit cattle, whatever version it is, they also introduce a support library that allows you to implement those new features on backwards versions of Android. So everything I have in lollypop So android five I can also implement on android four using the same code but with a few changes when I referenced app compatibility. So we just closed that and that is why this theme inherits from this. Okay, inside the theme we have a bunch of properties so the primary color, the primary dark color and the color accent. Now, if you refer to Google's guidelines on material design and you scroll to the section of style and color you can see it has thes colors off indigo and pink, which have already experienced within our own app design. These are the default colors that it gives you, but if we scroll up, it also gives us a bunch of pallets that fill its design philosophy, and you can download these. Or you can set the colors directly from what it gives you here. But just before we do that, let's come back to Android Studio and you'll notice these colors are assigned from a color the XML file, and these are contained in values again and colors dot xml. An android studio helpfully gives you a preview off the color on the left hand side, where it is declared. Now we're talking about making beautiful lapse here, and so we need to learn a little bit about colors and when to use them, how to use them and which colors we should use together. And to do that, I'm going to introduce you to one of my favorite tools, which is the color wheel by adobe. And it's the second link if you search for color wheel on color dot adobe dot com, and if we open that it gives us a color design wheel and you can have various rules, you can apply. Much as we applied photography rules. We can also have rules for color. You can have monochromatic rules. We can have triad rules. So we have three complementary and posing colors, and we have analogous rules. And for this project, I'm going to select some of these analogous rules, and I'm just going to scroll around and see what I like. And I kind of like this green color mixed with this purple color. And of course, we can change everything around. We can change the green and the purple to slightly darker colors like set, so I'm going to use this purple color as my main color. And down here it assigns a hex value, and if we double click on copy that, we can assign it to our color primary here, simply paste in that valley. Then it requests a primary dark color, so I'm gonna dark it. It a little and copy that on this primary. Dark color is just toe accent things in our you I. Then it asks for a bright accent and we're going to use this green color and we're going to pop that in there like so Okay, let's run, are out and see. Actually, we don't need to run around. We can just open one of our activities are XML files and we can see immediately the implementation off our color scheme on. I think that looks quite good, so I think we'll leave it at that. Now, when you're messing around with color, you have to be very careful not to overdo it. So choose to primary colors to start with and make everything lighter or darker around those colors. Okay, let's see what that looks like on the edit screen on the ad feed. Okay, on the ad feed screen, we have this bar at the bottom here. If I just saw its not add feed, it's actually content. Add feed. We have this bar, and it has no color assigned to it at the moment, and we also have a button that has no color assigned to it at the moment, So if we come to the design view, we click that button, we can set a background color on it. If we click the three dots, it will give us a bunch of colors and we can scroll down and go to color primary and click OK, and we'll color. It's the same color as are up main color. Then, of course, the text color has gone dark and it doesn't stand out very well. So let's scroll down and see if we have a text color. We do. So let's a sign a text color to that, and we do that by going to color's dot XML. Let's copy a line and paste, and we will call this light text color, and we will give it a value off. Let's go over here and see what we get when you play with some values. Let's make this not not not and that's dark. So let's make it f f f. And that's light. So six efs. He's a white color. It's pop that in that and save it. Go back to your content. Add feed. Go to text color, click the three dots, go to project. Let's scroll down to find out like text color click OK, and now it is a white color. Now that that's done, let's close that file and in fact, let's close the more. Now let's discuss where this theme is applied. Now this is applied under Manifest Android manifest. If you open that, we can see immediately. We have a Manifest XML document with application and activity under it, and you'll notice that Android Studio has automatically put in our different activities for us and in each one of those activities. It has assigned a theme which comes from style, app, theme dot no action bar. And if I click and open my style's dot XML, you'll notice the style off APP theme. Got no action. Bar only has two values in it. There are no colors, so you might say Where is the activity getting its colors from? Well, In the application section, a theme is applied, which is our theme that we set called APP theme. Then the activities apply these sub themes off. No Action Bar and Inaction Bar is a remnant from Android gone by that we don't really use anymore, and it's been superseded by current tool bars and various new developments in Lan droid five and six. So this is where the main application theme is applied, and all of the colors in here would get applied into these activities under the tree off application. Okay, that sums up the initial part of the design off the screens of our app in the next section , we're going to get into some actual programming, and we're going to link all of these screens together whenever we click associate ID buttons. So join me for that. Well, 13. Connecting up our activities using intents: Okay, so at the minute we have a basic app. We have our main screen where we can click our plus button, and we have this widget at the top here that allows us to change settings, come back to Andrew Studio and let's linked together are add feed and edit RSS feed activities. So let's open main activity dot Java and have a look around The first thing that loads up when we have our main activity is this on Create bundle and this simply gets the content view from our resource is it sets our toolbar, which is the bar we see at the top of our app, and finally it applies that tube. Then we have our floating action button or I'll fab, and this line sets that fab as a floating action button, and it finds it by our daughter. I d dot fam and that i d. Dr Fab is what we have in our content. Main dot Sorry, not our content. Main Door XML. It's in our activity main dot xml. So down here, android i d fab in Maine activity. That's what it's looking for. And then for the floating action button, we have a set on click listener. So every time it's clicked, the following gets called like so now we want to remove this snack bar, which was that bit of text that appeared at the bottom. And we want to implement our own action. And specifically we want to open the ad feed activity. And to do that, we first have to create an intent. Space intent is equal to now. Intent here has gone red because at the moment, our main activity doesn't know where intent comes from. But it gives us a suggestion and says, maybe or intent comes from android dot content dot intent. And it says, if you press your option key and enter, which I'm going to do now, it inserts up here an import so it inserts import android dot content dot intent on now intent is no longer read. So let's finish. This line is equal to new intent, and then we have to give it a fab dot gets context comma, and then we have to tell it which activity we want to open. So will be our ad. Add feed activity dot class Andi semi colon. Now again, you'll see we have a red squiggly line underneath Fab. And if you hover over it, it says variable fab is accessed from within. In a class needs to be declared final. And that's because this request to access Fab is inside this on click listener and to various reasons we can't have that. And the way to get around that is to go up to floating action button fab and before that type final. And that removes our era to come back down here to our public void on Click Press enter under the intent line. And now that we have the intent of what we're going to do, we are going to start on activity. And they asked us for an intent which we already have so intent and semi Colon. Let's go ahead and run that in our simulator, and when we click the plus button, it should open up the ad RSS feed for us. And here's our outfight up, and if we click the plus button, we get our add feed activity here, and you'll notice that Android has automatically applied thes accent colors for us on the lines. So if we type something, we have this green line and a green cursor and our purple button, which currently doesn't do anything. If you click back, you go back to the main screen. Okay, let's change this ad feed activity title here. Come back to Android Studio, close this debug and let's open up. Are android manifest and down in ad feed activity on the label, we can see it's requesting it from string title activity. Add feed, Let's open up strings. And here we have the titles for our various activities. So just remove that line. You don't have to do that because I had that from earlier in our ad feed activity. We just want to change this to add feed in our edit RSS feed activity. Let's change this to edit RSS feeds and save it. Now when you run it, that title should be back to what we expect. And here we go when we hit. Plus, we get add feed as the title. Okay, let's set our app toe open up Our edit RSS feeds screen. When we hit settings, come back to Android Studio Closed Activity main and android manifest. Come down to your debugging console and click stop on the left hand side and minimize it by clicking debug at the bottom. Now we have to handle that settings button, and that is defined here on options items selected, and the first thing it does is grab an i. D from the item that was clicked. And then it says, If the I D is equal to are the ideas or action settings, then perform an action. And that's where we're going to put our code to open up our edit RSS feeds screen. And our code for that is going to be very similar to what we had to open up our add feed screen. So again, we need an intense, which we can call intense equals to a new intent. The first argument will be this referring to our current instance. The next argument will be the actual activity we want to fire up. So edit RSS feed activity. Don't class semi colon. Then we have to pass that intent in tow. A start activity start activity intent like so let's open up our d bugger and run that. And now when I click that settings icon, I get my edit RSS feeds screen. So that's great. Okay, switch back to studio, stop running your app and minimize that debug screen 14. How to set up an SQLite database in an Android app: All right, let's look at adding an RSS feed to our app, and I've just got the activity Add feed open here on if you recall from previously we simply write something in the box and we hit save feet. Now, once that saves, android has to put it somewhere. And we cannot have it just running in memory inside our app because when you close your app , the memory gets purged on your RSS feed won't be there anymore. So every time you open your app, you have to enter the feeds again. What we need is a place to store these feeds on the Google Developer website on developers or android dot com gives us some options for storage. In particular, I want to highlight the options we have here. We can either use shared preferences, internal storage, external storage databases or something on the Internet. So first of all, we have shared preferences, and this is a standard way to store primitive data i e. Billions, which a true or false floats instant lungs, which are numbers and strings which are characters on a note that it says data persists across user sessions. Even if your application is killed or paused or whatever. Now, if I wanted to store an RSS feed address, I could say shared preferences store my address with a key, which is also a string off RSS feed one and I could do the same and do RSS feed two and three and four, etcetera. The problem is, you have no way of knowing how many of these shared preferences you've stored. There are ways, of course, but it's more complicated than it needs to be. So shared preferences are actually best used not for prime data storage, but rather, as the name suggests, for preferences in Europe. Like what color do you want the background to be? If we scroll down, we can use both internal storage and external storage. But do note that some devices can have external storage removed because there s D cards and such like so, if your app is running and someone removes the card, it could throw an error when it can't find storage area inside the internal and external storage, weaken store text files so we could have a text file off RSS feeds, and that would work perfectly well. And when our app opens it opens the text file, reads the RSS feeds line by line and stores them for us. Alternatively, and the one that we're going to use is using databases and in particular sq light databases . So I've prepared my favorite Lego illustration to tell you exactly what a databases. Because it's quite confusing for some people. Most people say, Why can't I just use a text file? Well, you can until you get to a certain point. And if you have a bunch of data so a bunch of strings like the RSS feeds, we can represent those as Lego blocks like we have here, and we can keep track of those in a text file. No problem. But what happens if I introduce some other variable? I have a bunch of, say descriptions off the RSS feeds, and then I have some more variables, like how many times I've accessed those RSS feeds in the past week. Now you can see how it starts to become a problem. How do you track all of these things inside of a text file? Well, that's where database is coming. A database is something that you can think off as a single file. So that blue bloc at the bottom there and all of our data is stored inside what are called tables inside that database, and each table is specific to a type of data. So our feeds a number of accesses in the last week, etcetera. And a database is a unified way off storing that primitive data strings, numbers and billions, dates and things like that. And if we have our device so iPhone 2000 on the left and we have our database on the right and in between the two is the interface that allows the iPhone to show us the data inside that database. So for all intents and purposes, you can think of a database as an advanced text file. There are many, many more advantages to databases like indexing, for example, that I won't go into. But if you want to read more, just simply search for Escalate or SQL or databases on Google, and you'll find out everything you need to know. Now, before we write our database, we first have to create something to store in our database. So we're going to create the class that is our RSS feed. So come back to Android studio. Close this activity. Feet or XML come over to Java and inside the com dot Whatever you named it, right? Click New Java class and we're going to call this RSS feed. Click. Ok, okay. Now we have a basic class called RSS feed. Create some space inside here, and let's create some class level variables toe hold our data. So the 1st 1 we're going to create is a public string on this is going to be RSS feed title . Then we're going to create. Sorry. Let me change this string to a capitalist. Then we're going to create a public string. All right, says feed address semi coat on. We can create an optional RSS feed description, but we're going to leave that out for now. Then we have to constrict. We have to create a constructor for our class, which is going to be public. And this must be the name off the class. So RSS feed and we're going to pass some things into this in particular. We're going to pass the string off title and a string off address, open your curly brackets and then inside here, we're going to set these strings equal to the arguments that we've passed in. So we're gonna say RSS feed title is equal to title and RSS feed. Address is equal to address. So that's RSS feed class set up. If you're not familiar but about classes and objects, then you should see my other you Timmy course, which goes over classes and objects and the fundamental pillars off object or into programming, which is what we're doing here. So close that Java file and will come back to it in a bit. Right click on the com section and click New Java class and inside here will go to have our database access class. So let's just call this database click OK, create some space inside our curly braces and save. Now database needs to inherit from something else, so we type extends sq light open help. Now, if you're not familiar with inheritance, then again see my other course on object oriented programming. Now, if we click on Esther Light Open helper by the red squiggly line, you'll notice we have a little light bulb over here on the left, and we have some options to implement the methods, and that's because this extension requires us to have an on create and on on upgrade method inside this class. So if you click OK, it will create that for us. Now, we need some variables inside our database, the 1st 1 of which is going to be a private static final int database. Under school version on the version of this database is going to be one. Then we need a database name. So again, private static Final stream data base Underscore name. And let's give it a name, which will be, uh, all right, says feeds. Except then we have to give a name to our table for RSS feeds. So let's call this private static. If I know string table underscore feeds as equal to feeds, then we have to give that table some column names. So private static final string key under school I d. Is equal to i D. And then private static final string. We need to give a key feed name or let's call this title to match Our class that we created earlier is equal to title and finally we're going to create I want actual key for our feet key under school feed address equal to address. There we go Now we need to correct this red up here, and it's simply there because we have no default construct to get so presenter. And let's create that so public, because constructors always are database. And we have to pass this a context called context and you'll notice it's got some red under it and free press option Enter. It'll insert a use an import statement at the top here, open code breasts and then inside here we just need one line, which is super context common. And then we need database name coma. No, come on, database virgin. And this just initialize is our database for us. Now we need to put some code inside on create on the inside There were going to create our table because if we try to save data into a database table and the table doesn't exist, will get an error and our app will crash. The first thing we have to do is pass is to create the query that our database is able to process. So if you're not familiar with this, then jump onto Google and look up SQL language so that query will be string, and we have to name it, something sensible. So create feeds. Table is equal to, and we're going to have create table. So this tells SQL to create our table and then we're going toe ad. I were table feeds to that, plus another one of those open brackets. That's it, plus our i D, which is key i d. Plus open quotes space into Jeff Primary key combat close quotes plus key name, which is going to get title plus open quotes. Text comma. Plus we need the key address ke feet address plus open quotes. Give it a type off text. Don't forget a space at the front and then plus our closing bracket. And save that. So all this line has done is create a string, which turns out to be a query that our database will understand. And the query is telling it to create a table, which is called this name of table feeds up here so it creates a feeds table, and then it gives it an instruction to put in a key I D column, which is the primary key, which every database table should have, and then to put in our feed, title and feed address into other columns. Finally, we have to execute that query and we execute that query on the database, which is passed in up here. So we're going to say, db dot exact x SQL. And they were going to give it that string that we just created, so create feeds table strength, and that should initialize our database for us. All that's left for us to do is to fill in this on upgrade. And this is when we upgrade our database version, which we're not going to tackle in this particular session. But in the future, it will help you to know it. So we're going to say, db dot exact SQL. And we're going to write our own SQL in here, which will be dropped table if exists. And then we're going to give it a table name, plus table feeds like so and then we're going to tell it to create table again. So if you have a major upgrade of your database, you can delete everything in it and start again. And that's handy if you've changed some sort of formatting or schemer inside your database . So to recreate it, we're gonna say on creates D B and that will fire off this on, create up here, hopes and create our table again for us. If it doesn't exist to say that that's what I'm going to cover in this lesson in the next one, we're going to create some database methods to do what are called crowd operations, which stands for create, read, update and delete. And these are all things we're going to need when we're creating our feeds on deleting them , So join me for that one. 15. Java code to store and get information from an SQLite database: Okay, let's write some operations for our database. The 1st 1 is to create an RSS feed entry. So let's type public, avoid add RCIs feed and then in our arguments were going to pass in an RSS feed. And we will just call this feed and finished creating our method. Before we write anything in there, let's go ahead and create some more methods that we're going to need. The next one is we'll need to get a list off. RSS feeds so public Avoid. Get RCIs feeds. Sorry, they shouldn't be void because we want to pass back a list of feeds. So let's say a list off RSS feed, and it doesn't need any arguments inside these brackets and curly brackets, and it says here it needs an import included. So let's go ahead and do that. And finally, we're going to need a method that allows us to delete an RSS feed from our database so this will be a public void. Delete. All right, sis feed. And then we have to pass it a particular feed to delete so RSS feed feet and finish off your method. Now let's add some code inside these methods and let's start with Add RSS feed. The first thing we have to do is get a connection to our database. So sq light database D B is equal to this, referring to this class for this instance and we type get right herbal database and this just returns a connection that we can use to our database. They would get type content, values. Values is equal to a new content values with no arguments, content values, simply stores and array of values. And then we're going to put some values into that so values don't put and then we're going to put in our key feed title coma, and then we're going to put in the name or the title of our feed, which we've passed in up here under feed. So we say Feed docked RSS feed title. Then we're going to put in another value so values dot put key feed address and we're going to pass it the feed doctor RSS feed address value. And then once we've done that, we're then going to insert those values into the road into the database. So we say, db dot inset and then we have to give it the name of our table. So table feeds and then another column back, which is just no for now and the values that we've created values and then a very important step that a lot of people leave out is we have to close the connection to our database database dot clothes. If you don't do that, you can have all kinds of errors which are very, very hard to track down and could be very frustrating. Okay, say that and let's fill in our get RSS feeds method. The first thing we have to note is that a list of RSS feeds has to be returned from this method. So let's create that return list. So we're going to create a list of RSS feed and we will call this results equals to a new list off RSS feed brackets and semi Colon. Sorry, we don't actually want to list. What we want is an array list, an array list, off type RSS feed, and we want an array list because it is re sizable and we don't know how many results we're going to get, so that might come in handy. Then we have to create our query to select everything from the database. So this will be a string. We will call this select Queary. This will be select stop from plus on the table feeds. So they're simply says select everything. Star means everything in query language from table feats. Then we have to open up a connection to our database. So I'm just going to copy this line from our add RSS feed control. See Control V then on the next line, we need to send our role query. So I'm going to say cursor. Okay, so, uh, is equal to db dot raw query, and we have to pass it our query, which will be select query and a second parameter, which is some arguments on for now. These are no semi colon. Then we have to loop through all of the rows and get the results from them. And the first thing you have to do actually is correct. This cursor import that it would like so command or option. Enter. Then let's go back to our loop. We say if Cassa don't move to first that selects the first result, we say, Do Orestis feed feed its name it something else. RSS feed is equal to a new RSS feet. So we're just creating an RSS feed for its result that we find. And each result from our database is going to give us three parameters, the first of which is this feat title, then a feat address. But it's also going to give us a key i d on the I. D is the databases way of tracking unique entries is a unique I. D. So before we change anything here, we actually need to go into our RSS, feed up Java, and we need to add an I D property into here. And to do that we come up to our class variables and we add a public int i d. And then we have to create another constructor because sometimes when you create an RSS feed, you won't have an i d toe assigned to it. For example, when you put it when you enter it on our ads feed screen. But on other times like now, when we pulled an RSS feed from our database, they will be an I d that it expects. So that's where we do what's called polymorphism. And if you don't know what that is It's one of the fundamental parts off objects or into programming. And you should take my other course. That teaches you exactly what these are. So we have another constructor here and in here I'm going to pass an integer feed I d blank . So then I'm going to pass my feet. I d into my i d I d equals feet. I d. Okay, close that file. Now come down to your get RSS feeds in your data based on Java and within the brackets for new RSS feed, we're going to pass all the parameters that it expects. So the 1st 1 that expects is our i d. And we're going to get that by pausing on into and this is going to come from our cursor. I don't get string. And then it asks us which column we would like to get the string from. And this is going to be column zero. And we know that because if we look up here in create table, we created a table called Feeds. The first column is key. I d. The next one is feed title. The next one is feed address. Then we have to pass in another argument and this is cursor, Doctor, Get string and we pass in the next column, which will be column number one. And we do the same for the feet. Address cursor. Don't get string. Call him number two and that creates a new RSS feed for us with the i. D. The feet address on the feed title. Then we have to add that result to our list of results which we created up here. So we say result Don't ad, and then it asks us what we want to add. And we just want to add the RSS feed we just created and save that. Then we have to complete our do loop. And we're going to say, I want you to do this RSS feed collection while we still have things to move to moved to next. As soon as we run out of things to move the cursor to, then you're going to stop creating this list. Then we have to return our results. But the first thing we have to do before that is to close our database, so db dot close. Never forget that. Then we're going to return our results on that red squiggly line has gone away because now we're returning something that it expects us to do. Okay, the last thing we have to do is to delete an RSS feed. So come down to this method and place your cursor there and in here again. We need a connection to our database to SQL database. D B is equal to this dot get rentable database, and then we have to give it the command to delete something, which is db dot delete. And then it asks for a table. So we've already created that table feeds and then a wear clothes. So we're going to say, I want you to delete something from the table where the key I d plus quotes is equal to space question mark an outside of that press comma, and we're going to give it a new string array. And inside that array, we're going to create the stream docked value off, and we're going to pass that our i d from the feet we passed into this method. So we say feed, don't I d fee dot I d There we go. Okay. And that with semi Colon. And finally we have to close our date space and safe. And there's nothing to return here because we're simply deleting something. So all that line does is it opens up the table feeds table. It looks for a key I d. That equals two. And when you have a question mark here, the method will then go to the next argument and look up this value and replace it into that question mark. So it'll get the key I d. Place into that question mark and delete that item from the table if it exists. So let's save that in the next lesson. We're going to look at how to call all of these methods we've just created in order to store an RSS feed in our app. 16. Storing our RSS feed in the SQLite database: Okay, let's go ahead and storing RSS feed. Let's open up our add feed activity and in here we want to start creating some references to the button that we created. And if I open that activity up, we can see there. It's the same feed button, and we want to store the address that's typed into this line. To come back to your own creates have to get support Action bar, create some space and let's begin coding. Let's grab a reference to our button. So let's type button save button is equal to and then in brackets. We have to give it a type two caste to which is button and then find view by I. D. And this is our stands for resource is your I d Don't and there we have it at the top. There, add feed button, and this just simply grabs a reference to the button we have in our layout. The other thing we have to grab is a reference to our text entry, which is up here. If I open content, add feed. This text box is of type edit text, so we need to find an edit text box called add feed, edit text. So here we're going to have edit text is our type, and then we're going to call this feat. Address is equal to and it text and again we find the view by i d r dot de dot add feed edit text. Sammy Kodo. Now we've got those two values we need to give our button something to do, and we wanted to do something every time it's clicked. So we type save button, don't set on click listening And this just simply says every time someone clicks it, I want you to perform the following function with an inside there type. I want you to create a new on click listener, and then within this method, it's going to do whatever we requested to do. And what we need is for it to get the text from the edit textbooks to create a new RSS feed and to plug the RSS feed into our database. But what if someone sets the text of feet address to nothing? Well, then it's still going to save something. It'll just save an empty string. So the first thing we have to do is ensure that our user has put in a proper address, and we're going to do that very simply. We're going to say, If I wear feet address dot get text and that gets the text, then we're going to check the length off that text. So how many characters air in it? And we say, If that is less than, say, four characters or maybe six characters as it is a Web address, then we're going to let the user know that that is not unacceptable. Address. There are two ways we could do This. One is to make what's called a snack bar, which is a little message that appears at the bottom of the screen, and you can either have it set as a short appearance or is an indefinite appearance for the user to swipe away. Alternatively, we can set a toast and a toast is a non interact herbal use Ah, information elephant Eller HeLa front element that appears that tells the user that something has gone wrong. So let's create a toast so type toast don't make text, and then we need an application context. So let's just type get application context and then let's give it our message we're going to show the user se RCIs feed. Address is too short. Come on. And then we have to give it a duration. On this duration will be toast dart length. We can never have it long or short. Let's go with long on then, Once we've grazed it, we need to show it and we use the method dot show for that and that will show our toast. After we've shown that toast, we need to exit out of this method to make sure nothing gets saved the database. So we type return now under the if statement. If the feet address text lymph is larger than six, then this will not run. And instead, it's going to come down here and run our code for our database. So let's. Instead, she ate our database, which we database DB equals a new database. The context is add feed activity dot This normally, you would just write this inside here. But if you did that, it would refer to this on click listener that we've created. So we have to explicitly say it's the ad feed activity context. Okay, Now we just need to call our database function to save our RSS feed. But the first thing we have to do is create an RSS feed toe pass to that database. So let's type RSS feed. Feed is equal to a new Ari, says Feed, and then it asks us for some parameters. So first it asks us for a title, which we don't have necessarily because we haven't specified a title for us to type in. So what we can do is go ahead and change that. Now in our content, add feet dot xml. We can add another edit text, so that's come to our design view. Let's drop in our plain text text field just above our other field. Come back to the text version, and that has shuffled things around somewhat. And it doesn't matter because it's a relative layout. But just so it's clear for us, I'm just going to put the button down here, okay? And I'm going to shift this at it. Text, which is the top one to the top. Okay, at the moment we have our old edit text from before, which is fine, and then we have our new edit text and we need to change the width to match parent on. We should give it a name which will be at Feed name and it text, and that gives us two items to enter data into. So say that come back to our add feed activity dot Java and of course we have to again get a reference to that. So let's type Final and its text feed name is equal to and it text find view by i d r dot I d dot Add feed, name, edit text end with a semi colon. Now, if we come down to our database, we can say on new RSS feed and inside the brackets the arguments at once is a title first and we'll get that from the feet name dot Get text and it asks us for the address So we'll get that from feed address dot get text and semi colon. And now it's got some red squiggly lines here and if we hover over them, we can say RSS feed java dot language string cannot be applied, and that's because we have a type mismatch. So we have to explicitly convert these two string and again here, too. Strength and our red squiggly lines go away. So now we've created are feed. Let's pass it into our database. Let's type database dot and we have a list of the methods we created. We're going to add our feet feed. Okay, let's fire that up in our simulator and see if it works. So here it is running. Let's hit the add button and it should pop up with our at feed screen. We can type a title, and we can type a short address. And when we hit, save feed, it says RSS feed address is too short because it's checked the length of this address. So let's say W w w your rss dot com and when we hit, say feet, that should now have saved it. If we switched back to Android, we have no errors coming up. So that's good. Stop that running and let's go one with the next part. But before we get there, there's something that bugs me slightly, and that's this layout. We now have to text entry boxes, but our user doesn't know what each one means, and again, this comes down to the usability component of our app. Everything has to be really obvious for abusers so the way we change that is on the top one . If we click it and we come over to properties, we have an element called hint. An inside hint weaken set a text that tells our user what they should put inside this box. So let's create that inside our strings dot xml. Let's press, enter its copy a line for speed, paste it in and say, Let's call it. Add RSS feed, name, hint and in the text section, we're going to say and name full feed, and then we're going to do the same for the address line at RSS Feed address Hint and will say and toe address for feed and save that. Then come back to here. Click on your elements. Go over to hint. Click on the three dots and under strings. We will have and add RSS feed, name and address, and let's do the same. For address. Add RSS feed address. Now we have some hints for our user. Enter name for feed and enter the address for feed. So that's saved that and close our strings XML and come back to our add feed activity. Now we have to let our use and know that they feed was saved. So let's just give them a text. A toast. Rather for that. Let's copy this toast line and added below here, and we will call this toast. Don't make text. All right, sis. Feed added. Now again, in here, you can reference your strings dot xml and ad your text in there. And if you're going to translate things, I'd recommend that's the way to go. But I'm just doing it here for speed for this course now under here. Once you've saved that, it's still going to have that text inside those boxes. So I dearly we need to clear those boxes. And that will also prevent our user from pressing the button twice because now the box will be empty and they'll get a message that says the feed address is too short. Let's do that type feed address. Don't set text and simply give it an empty string. And then let's do the same for the feet Name. Don't sent text andan empty strength that say that and that should complete that section. Let's run it and check that it works. Okay, here we go. That's hits the add button, and when it pops up, it's enter a name called Test and enter an address www dot address and say feet, and it says RSS Feed added. Now it's up to you. What you can do after you've added this feed is you can close this view if you like, and go back automatically to here. I'm going to leave it as it is to allow my user to put in multiple feeds if they want to. But you can have it exactly as you want it, right In the next lesson, we are going to look at opening up the settings controller and showing a list off the RSS feeds that we already have. 17. Setting up a ListView adapter for a list of RSS feeds: Okay, The next part of our app that we have to tackle is this list off RSS feeds that we already have stored in our database. And if you recall, this pops up on our setting screen and we're going to configure it so we can delete feeds from it, etcetera, etcetera. But before we get into building it, I need to explain how a list view works. And the pattern I'm going to show you is also the same pretty much in I us. So once you know this idea behind a list view and it's adapter and sells, then you'll be able to do this on I us as well. All right. I've just done little mock up here in Lego off what exactly a list view is. And on the left hand side, I have my mobile phone and inside there I have my screen, which has a list view in it, and this list view is displaying bits of data. Each part of the list view is called a cell, and a list view is just a collection off these cells. Now an adapter is the part off our program that feeds the list view so the adapter passes in these cells to the top or to the bottom. Depending on which way was scrolling, the adapter has to provide the cells. It can either create a new cell and pass that in. But that's expensive to do in computing terms. And it's much more efficient if we take a recycled cell that's passed off of the screen either the top or the bottom, and we give it to the adapter and the adapter then gets a list of data and picks off the 1st 1 from that and attach is it to the cell. It then passes that cell into the list view. So an adapter you can think off as the conductor or the orchestrator off everything that's happening with your list view. It decides if it should make a new cell or if it should use a recycled cell. It then attach is the data we want to display to that cell and then feeds the cell into our list view on our devices screen. And the very first thing we have to do is create the adapter. So right click underneath Java and com Click New Java class, and we're going to call. This are Isis Feeds Adapter. Now RSS Feeds adapter. He's going to extend array adapter, which has a type off RSS feed, and then do option enter and will enter a rare doctor for you. Then we need, of course, a constructive for this. So that will be public RSS feeds adapter. And it takes a context which we were cool context. And it, of course, needs a list off RSS feeds because we're going to pass those to it. When we create this, Let's fix this list resolution Here. There we go. On this list of RSS feeds is going to be called feeds and open and close our method inside the method we need to call super context come in zero coming feeds. And that line simply says to initialize the parent class before this is initialized. Okay, Once we've done that, we are going to override something. A method called get view and get view is the method that either provides our new cell or recycles on old cell, and you'll need it for every list adapter that you have. So we get back by typing at override public if you get view and this has some parameters passed in. So it has a position which is the position of the cell in the list view. It has a view passed in, which is convert for you. And it has a view group, which is the parent. I wouldn't worry about that for now. You don't need it. And let's correct these resolutions up here. Yeah, we get now inside this get few method. We first have to get the data. So RSS feed feed is equal to get item at the position. So this will look at the position we are in the list and get the corresponding feed from the list of feeds. Then we have to check if the convert view is no. And now all simply means that it doesn't exist yet. And that means that we haven't passed a recycled one. So we say, If convert view is equal equal to know, then convert for you is equal to layout inflater. And all this does is say, if we don't have a view that's been recycled, then I want you to create a new cell from our layout. Inflater. So let's continue that dot from get context. Don't inflate forgotten one bracket there dot inflate Hang on getting confused with my brackets here and a girl from context dot inflate I see what's gone wrong. We have an extra bracket here, said from context And then at the end, we're going to have dots inflate. And then we have to find the cell that we created for our edit view. And that's this one Here. Edit feed. Oh, sorry. RSS edit feed item row. So let's find that that's under our dots Layout Don't RSS edit feed item road. Okay, Then he asked for some more arguments and it wants the view group route which was passed in as parent. And finally it asked us if we want to attach this to root and in this case, that is false. We do not. And with your semi colon. Okay, so that gets us a new cell. If a recycled one hasn't been passed once we have the cell, we then need to populate it with some data. And the first thing we have to do before we do that is we have to find the text views that we created inside ourselves. So text view feed address is equal to text view and then we do the usual convert view dot find view by i d and let's find those That was our dot i d don't edit RSS Let's find it RSS edit feed, address, text view. That is why we name things. Really. Obviously when recoding is so we can find them later on without having to click open other files. Then we have to do the same with our feet title. So text do you feed title is equal to text, view, convert view docked find view by D and let's find that one are dot i d'd rss edit feed title text view. Okay, now we have our text views. We can set the text of them so we will say feed address dot set text and our text is going to come from the RSS feed we pulled from the database. So that is going to be feed which we declared up here Don't title and let's do the same. Sorry, I've made a mistake there. Feet address should actually be set as RSS feed address. Then let's set the title feed title dot Set texts is going to be the RSS feed title. Finally, once we've curated our cell. We need to return it to our list view. So we say Return, convert view semi colon and that's all you need for a really basic feed adapter. Now, if you go on the Internet, you do come across tutorials. That's instead she ate the really basic feed adapters over the really basic array adapters that Android has built in, and they can be used in just one or two lines. But very quickly you're going to find out that they are extremely limited. And the way I've shown you is the way that you want to do all of your adapters in the future. And you're going to do this so many times that this will become almost automatic to type out. So all that remains is to apply this adapter inside our edit RSS feed activity. So let's open that and underneath, get support action bar inside your own, create method type the following. Let's say a list off RSS feed and we will call this list. Feeds is equal to new database, and we have to pass the database of context, which is this dot get RSS feeds. We should recall that was our database class and it returns all of the feed stored in our database. So now we have our feeds. Then we need to. Instead, she ate the adapter we just created. So we say RSS feeds adapter adapter is equal to a new RSS feeds adapted. And then he asks us for a context and that's this. And then it asks us for a list of feeds which we've just created. So we say feeds semi Colon. Then we have to find the list view within our view. So we do that the usual way by saying list view list view is equal to Listsview. Find view by i d r dot our doctor i d dot edit RSS list view and then we just need one more line than that is list view dot set adapter. And we have created the adapter, which is adapter. Okay, let's debug that and see what we get. And here we are. Let's open our settings and we should represented with a list off the feeds we created earlier. Let's go back and create another feed, so I've clicked the plus button. Let's say this feed is called ground and the address is w w dot ground dot com and say feed , Let's go back. Let's open up our settings and we're presented with my feet there Now, At the moment, tapping these feeds does absolutely nothing. And the reason we haven't edit RSS feeds screen is so that we can delete things from our list. We might not necessarily want them there all the time, so in the next lecture I go into that. 18. Editing a ListView and removing elements: Let's look at how to remove the feeds from our list. If you recall from our app when we click something, nothing happens. What we would like to do is to pop up a box, have some sort of confirmation that allows us to delete these items. So if we come back 200 studio, the first thing we have to do is set on on Click Listener for our list of you. Let's have list view dot on item click Listener, and then we have to set a new on item click listener, and this will get fired every time our list view, one of the cells is clicked. And then in here we want to right and let dialogue, and that will let us choose if we want to remove or keep the thing we've collect on type elects dialogue docked Builder A. D. B. In fact, let's call it dialogue because a DB means something else in the android world is equal to a new alert Dialogue builder doors build a and we have to pass a reference of this activity. So we say edit RSS feed activity docked this and once you've created that, we need to set some properties on it. So the first thing we do is to say dialogue dot set title, and we will call this remove feed. Then we're going to set a message, which will be dialogue Dark set message, and we'll set it to something like, Are you sure you want to remove this feed and let's set some buttons for this dialogue So we will have dialogue, don't set negative button, and this we will call no and have a non click listener off. No, because nothing's going to happen when we click it. Then we need a positive button. So dialogue docked, set positive button, and we will simply call this. Yes, and he asked us for an on click listener, so we will create one, which is an elect dialogue. Don't on click Listener and then inside here, open and close curly braces because inside here we're going to have a method. Let's set this as public avoid on Click and give it some arguments, which are dialogue, interface, dialogue, comma, which, and then open your curly braces and close them for that method, and then finally, down here on set positive button this corresponding bracket put a semi colon to close it all off. And now there should be no Harris. Okay, now that we've created that inside here is where we're going to remove the feed from our list. And it's also where we're going to remove the feed from the underlying data source, which is our database. Now, if I want to access the list of feeds, I would normally type feeds dot or feeds open square bracket or something like that. However, there is a red squiggly line under it, and it says variable feeds is access from within. In a class needs to be declared final. We can either declare it is final or we can make it a class level variable. So copy this up. Here, list RSS feed feeds and place it up here in our class variables and then come down here and remove this list RSS feed because we've already declared its type. And now down here in the public void feeds is visible to this method. Okay, delete feeds from that little area, and then type RSS feed. Selected feed is equal to this is because we want to select the feed that the user has tapped on. So we're going to pull that from the original list of feeds that we just changed. And then to get that we need a position on the position is declared up here in the on item click Buy into position. Now there's a problem because this is its own method. This is his own method, and the two can't really talk to each other, so we need to declare a position as a final. So we're going to come down here, and we're going to say final in position to remove is equal to the position. Now come down here to our RSS feeds, selected feed and put position to remove into their and put a semi colon. Now we still have a red squiggly line, and it says Honore type expected, but instead it found a list off RSS feeds on. The solution is simple. It's my fault is a programmer because I've used a methodology that I'd use in C sharp. But in Java it's very slightly different, so I would say feeds dot get on. Then it says, provide a location which is an inter jet which we've set as positioned to remove. Now that will return the selected feed to us then what we have to do. Israel delete that feed from our database. So let's fire up our database again. Let's say you database and it asks us for some arguments, which is this and then we say dot delete RSS feed and we give it the feed that we just selected. And we have an error on this, and that's because we need to declare which activity it is. So we will say Edit RSS feed activity dot This like so? Okay, that removes it from our database, but it hasn't yet being removed from our list. Now there are many ways to do this. You can remove it from the underlying data source if you like, or you can just call the whole adapter and the whole lot again. And I prefer the second way because there were less things to go wrong. But the other way is equally is relevant. So what we're going to do is recreate the adapter and then clear our current list view and set the adapter again. So let's hype RCIs feeds adapter adapter. New is equal to new RSS feeds adapter, and it asks us for a context, and that is edit RSS feeds activity dot this and then it asks us for some feeds. Now, if you recall, we've only changed the feeds in our database. We haven't actually changed them in this list we have up here, so we need to do that first. So underneath the new database, delete RSS feed. Let's get those feeds that are remaining. Let's type feeds equal to new database and it RSS feed activity dot This and then dots get RSS feeds, and that will get our new list of feeds minus the one we've just removed. Then we can put that into our depth as feats. Finally, let's set the adapter on our list view listsview dot set the doctor adapter New. Now we have to set one final parameter, and it's one that gets me almost every time, and that's when you create a dialogue. It's not enough, just created. You have to explicitly show it. So we have to have dialogue dot show right. Let's run that in our emulator. And here's our out Let's Click settings and were presented with our list of feeds. And when I click a feat, it asks me, Do I want to remove this feed? If I click? No, the box goes away and nothing happens. If I click Yes, then the books goes away. It gets deleted from the database and it gets removed from this list. So if I click another one say test, I can remove that, too. And if I go back and then go back into settings, I should only have one feed left in that list, and there we can see it. Okay, lets pretty this up a little bit, because in our settings this looks a little bit sad. So come back 200 studio Stop your D bugger and let's come to our content. Edit RSS feed, Right? So in here we have our list view and we want to pick out the row, which is the edit feed item row. And what we want to do without text view is make this slightly larger. So let's click on the design tab. Click on the title text view on Let's look in the properties pain for something we can change. So down here we have a textile which has nothing applied to it. At the moment, we can select bold if we like. So let's do that. Let's scroll up and let's change our front size, which is actually located down in text by text size so we can put some different values in here. Let's try 24 DP. Let's see what that does. That makes it somewhat larger. Let's have a little bit smaller at 22. Okay, No, inside of our app. We have some padding in here, and that's fine. And I think we'll leave it at that. Now. We do need one other thing, and that is tohave something that notifies our user that they can tap these items to delete them on. For that, we're just going to have a small text view. We're gonna drag it to the bottom So these two green arrows appear and it sticks it to a line parent right on the line parent bottom. So it will always be in the bottom right hand corner, and then we're going to change that text view to tap, to remove, like so now the user will know they have to tap that in order to remove. It is one other thing. If we switch back to our app this title view sits right at the top of ourselves, and that might not be a good thing if you have another cell on top of it. So let's give it some space to breathe. We can either do it via padding here. In fact, let's do it via padding all. We can do it by a margin. So the margin, the padding at the top. Rather let's try 10 DP And there we go. We have a nice bit of padding for that, and we can do the same to the actual address of it. We can put a little bit of padding in this off, say, five dp. And now, when that's actually in our list view and there's a bit of padding on the sides anyway, I think that will look quite good. So again, if you recall our IOS and Android guidelines for design, they specifically say, you have to put the content the user wants to see at front and center and on this screen in each cell. It's the name of the feed because they might want to remove their feet from Engadget or the BBC, whatever it is, and this way they can find it a lot easier. And that concludes the construction of our edit feeds Scream in the next. Lessons were actually going to get into the meat and bones of this app and that is pulling the RSS feeds from the Internet, passing them and putting them into the main screen off our app, which is this screen back here. 19. Android app permissions (accessing the internet in our app via manifest.xml): Okay, let's talk about permissions now. Android is what they call a privilege separated operating system, and that means that every application runs with its own distinct identity, which is kind of a limits user I D and Group I. D and parts of the Android system are also separated into their own identities. So in this way, Line X does what's called sand boxing. It separates and isolates applications from each other and from the system, and that ensures a greater level off stability Overall. Now, occasionally you need access to things like the Internet or the camera, or the flash or whatever it is on Android. The android system gives you a finer grained control for that, which is called permissions and permissions are defined in our android manifest. So let's go ahead and open that permissions are something that has seen whenever you're user downloads the out, and if you have five pages of permissions you're requesting, your user will not install your app. So always only take the minimum number of permissions that you really need for your app. Now we declare permissions directly below the manifest tag as the first line on the way, we do that is, we type uses dash permission, and then it asks us for a name of the permission. And in our case, we want the Internet. So if we scroll down, we will find it says here Internet. If we double click bent, it puts it in for us. Then we close our XML tag, ford slash bracket. And now, when our APP runs or when it's first installed, it will ask for this permission, and it will be able to access the Internet. Any other permissions that you need, you do the same pattern uses permission, and I'm just going to scroll through a few of these on one that you may need is right. External storage. That's quite popular. One. If you need to write a file at the moment, I don't think our APP will need that because it accesses its own storage area for its database. And there are various other things you can see in here something to remove that and that covers permissions. You can request android permissions when the APP is running, but I wouldn't advise you to do that. I advise you to set them all in your manifest 20. Creating our RSS Feed Item class to use with the library: All right, let's create our RSS feed item. The first thing we have to look at is exactly what an RSS feed is and our S s stands for really simple syndication. And it was a quick and easy and low data way to send information about news stories across the Internet. So if I pull up an RSS feed in Firefox, it automatically pauses the feed for me and gives me this view. So have the BBC news feed open? If we look at the source of that view, we can see something very familiar. We have, first of all, an XML document with the XML Declaration at the top line. Let me just make that a bit larger for you. And then we have an RSS element and then we have a channel. A channel is required. The channel must have a title. It also must have a link and it must have a description. So all of these elements so far are required. The channel can have some optional elements like language, last bill date, copyright image, etcetera. But these don't necessarily have to be there. Once you've declared your channel, you then declare or items and an item must have a title. It must have a description and it must have a link. So with an RSS feed, you can always rely on these items. Toby, they're generally the item can also have a pub date which we can also pause into a variable that allows us to arrange RSS feed items by published date. So let's create our RSS item. Right click New Java class. And let's call this process item. Okay. Now, just open up your RSS feed. And if you recall, we had some public variables inside there now close that again. An insight RSS item. We're going to do things slightly differently. We're going to do them in a way that another programmer might expect. And that is to make variables private, so nothing outside of the class can access them directly. So the first thing we're going to have is a private string tyto for ah item title. I'm going to have a private string description, a private string link like that. Then, of course, we make our constructor. So that's public RSS item and we pass it some variables, so he's gonna pass it a title. We're going to pass it a description and we're going to pass it a link. Except then we're going to say this dot title the title belonged to This class is equal to the title we've passed in, and we do the same with the others. So their stock description equals description. And this dot link equals link. Okay, Now, what if we only pass in one thing or zero things or whatever it is? Well, we're going great. An empty constructor. So we're going to say public are isis item, and we make that empty. So at the moment, what we can do is we can create this object pass in the title description in Link, or we can create an empty object and later run. We can pass in the title description in link, but because these are all private outside of this class, we can't actually see these. So we have to do what are called access methods, and these are public. And we're going to call this sorry public void set title and we passing a string called Title. And then once we've got that, we set our internal title. So this doc title equal to the title, we've just passed in. Now this may seem like a long way round of doing things, but if you have two programmers working on two different classes that are talking to each other than this way avoids any errors so I can change whatever I like inside this method. If the other guy called set title, he doesn't really care what's inside here. And this is one of the fundamental principles off object orientation, and that is encapsulation on abstraction. So you take away the complex workings off your class from whatever else is accessing it. And if you want to know more, then please, by my other course on the introduction toe object orientation, because that explains all of these concepts. Okay, now we've done that for set title. We have to do it for description, public void, sit description, and we pass it a string called description. And we say this stop description equals description, and finally we do the same public void sent link, and we pass it to link, and we say this dot link equals link. Now what if I am not in this class and I want to access the title well at the moment, I can't because it's private. I can set it so I can change its value using these methods. But I can't access any, say we need some access methods. It's a type public string get title and then empty arguments on inside. There we say return title, and we have to do the same with all the others. So public string, get description and return description and then finally we have to do it with Link and Android. Studio is very clever because if you start typing, get it will imply that you don't have a method. Forget link yet, and it will put one in for you. And for this one, we want to return link. Okay, so it seems very long winded. But in the end, this is going to make your debugging life much, much easier. And I'd advise you to create or classes this way every time 21. Installing a library within an Android project: all right, let's look at actually extracting some RSS items from our feeds. Now we could reinvent the wheel and we could create our own RSS feed reader on Android is perfectly capable of doing that. However, I'm going to show you how to include someone else's library for doing an RSS feed. And I've got to get help Repository open here, which is called Simple RSS to Android. And the description says It's a really simple are says 2.0, pas a library. There's some other stuff heater enough to worry about. We'll go through it and it gives us a nice example, which does indeed look very, very simple. So what we're going to do is we're going to download this jar file on. We're going to include it in the libraries in our project, so one get hub. You need to go to get hub dot com ford slash s a l e N d r o n slash Simple dash RSS to dash android. I'm going to put that inside the description for this lecture so you can access it easily. Once you're there, just hit download zip, and it will download it for you and once it's downloaded, unpack it back and Androids due to go Go to the left hand pain and at the top where it's his android, Click that down and click Project And then inside project we have a bunch of folders, an inside personal RSS feed, right click new directory and type Libs Ally B s and then inside Libs. You should drag the jar file that you downloaded. So if I just show you where that is in my downloads I downloaded simple RCIs to Android master. And if I open it, I have this jar file here. So I'm just going to drag that into my lips, like so it asks you if you want to move it and we say okay and click. OK, now we have a Libs folder. Expand the Libs folder, right Click on your jar file and click. Add his library and then add to your up click OK, and that should have added it. All right. On the left hand pane, click project switch back to your android view. Now, every time we add a library or something similar, we should always test it, and we should use the simplest case possible. So let's open up HOMAINE activity and underneath are floating action busing declarations. Let's make a little space. Let's go over to the get hub project and let's select the example that he provides on there . So right, click copy, come back and paste it in directly to our on create method. Now, of course, it requires some import statements. So just at those, whatever it asks for list toast, etcetera. Okay, we're just going to remove this toast one here because we don't need it. In fact, we can comment it out with a ford slash ford slash And then I would like to draw your attention down to here. So the way this library works is a Parsa is created that goes and looks for on a dress. And when it gets all of the data from that RSS feed it then fires off. This method called on feed past and a list of items is produced from there. Inside that method, we looped through each item using a for loop and we right out the title off that item to our log Doc debug and I'll show you where this is when we run our app okay. And if there's an era than this on air, a function is called. Now, there's just a slight error down here in his code. And that's that. These Conerly semi colons are in the wrong place. So delete this one and then pull up this one, and that should sort out all of the problems. There we go. Okay. Now, the best way to see if this works is to run it. So hit your debug. Click OK, and send it over to your simulator. Here it is fired up. Of course, nothing's happening on the screen. If we come back to Android Studio and then we click down here on Android monitor. This opens up the debug interface for us, and if we scroll up and down, we can see here. We have some lines that are related to this simple RSS to pass a demo on that section. There is what's printed there in our log dot debug as a label on this section. Here is the title that this library has retrieved from the RSS feed so we can see that it works and it retrieves several things. Okay, Now the trick is we don't have one feet. We have many feeds and we want to create a very large list of the items from all of those feeds. So in the next lecture, that's exactly what we're going to cover. We're going to cover how to class this pasa and get all of our feed items. 22. Fetching the RSS feed items from the internet (and our first bug): Okay, let's look at getting our feeds into our list on our main page. The first thing we have to do is cut this code that we use to test the library off Simple RSS, too. So do command X or control X and come down and create a new method. And this will be public void. Get feed items and it's going to have one argument and that would be the feet address. And then inside that method paste the code that we just had then in this line, new simple RCIs to pasa instead of this address, let's type feed address to give it the address that we passed in. Okay, Now we don't simply want to just show the title of our items in our logged up debug That's useless to a user. So we need a list of RSS items where we can store these items. So writes the top of our class. We're going to create a class level variable which is of type array list, and then we give it our type, which is an RSS item that should be capital are and we will call this RSS items and then a ray list is missing an import. So command enter will sort that out for you. Okay, Underneath floating action button Inside our own create method we need to initialize that list. So we say RSS items equals a new a ray list and of course we give it out type again, which is RSS item and semi colon. So once we have this list ready to go, we then want to give our get feed items method our list of feed dresses one by one and we want it to go off and then get those feeds and put them into our RSS items. So the first thing we need to do he's come down here where it says on feet past and you'll notice it goes through each and every feed that we have on what we want to do in here is create a new feed item. So we say RCIs item item is equal to a new are isis item and then open curly brace and put your semi colon at the end and then within here we can start to set some things. So our says item, we can say set title, semi coat on, and once we have that item, we could start assigning things to it so we can say item dot set title and then we have to give it a title. And of course, that title is passed in. If we look at the pattern from our example here under items dot get, I don't get title. So let's copy that and put it inside our set title. And then we're going to follow the same pattern for our description. So set description, and we're going to pace that in again. Items don't get I don't get let's type get and see what it gives us. And there you go. It allows us to get a description from our library. And then, of course, we're going to do the same for our link dot set link and then in here. I'm sure if we get rid of get title, we can have a get link, and that's very useful. Ah, but we have a red squiggly line. Let's see what that is for. That is telling me that set link in my RSS item cannot be applied to java dot net dot u r l . And that's because this library is returning a U R L for link and not a string. So we can easily fix that. We can go to our RSS item dot java and we can change the type of link to you are no So and then we have to come down here and change the set link to you R l on the get link. Two u r l and we have to add a on import and then everything should be fine. Ah, we also have this method at the top here that expects a your URL link. Here we go. So say that come back to main activity. And now that red squiggly line has gone okay, Now this log dot de we can remove. Let's get rid of it now we have our items set up or we have to do is added to our list of items. So type RSS items, doctor ad and we want to add our object. And that is simply item. And so me coat on. So every time this method gets a list of items from an RSS feed, it's going toe. Add each item to our list off RSS items. Okay, Come back to our own create section now, we haven't actually called the get feed items yet because first, we need a list off feeds. And if you recall, this is something we got from our database. So all right, at the top, let's set a class level variable toe, hold our feeds. So this will be list RSS feed. We will call it RSS feeds and then down in our own create method, we're going to assign this RSS feeds as equal to a new database this and then docked. And if you recall, we have a get RSS feeds in there that will give us all of the feeds that we need. Then we need to loop through each and every one of those feeds and call this method for it . And then it will retrieve each item and put it in our list. So to do that, we type for in I equals not I is less than the size off our RSS feeds dot size and then I plus plus to increase the count each time we go around. Okay. And whilst that's going throughout feeds, we then only have one line to do. And that is to call get feed items. It asks us for a feat address, so we have to pass it a string. And that will come from our RSS feeds dot Get the location, which in this case, is I and then we have to give it a link. Sorry dot rss feed address. Mike said. Okay, so now it should go through each feed, run this on each feed and add the items to our list. Let's just run it and check that everything compiles and we have no major errors. And so I wrapped fired up, but it's immediately crashed, and it said an application not responding happened or we had an exception that wasn't handled. So if we come over 200 studio and we hit Android Monitor and we scroll down through this, we're going to see what this exception waas. And it tells us it was unable to start the activity. And if you scroll down, it tells you it is caused by a malformed your l exception. And that's because one of our Urals was this which wasn't relevant as an RSS feed. And so our library through a big era. Now that is one thing you have to watch out for when you use the library. And that's how well has the library implemented error handling? Because if I'd created that library personally, I would have said, What I need to do is to make sure it still works, even if someone gives me a wrong address. So let's look at fixing this problem. Let's stop that running in our debug terminal and minimize that and in the next lecture will look at various ways we can fix this book. 23. Fixing our RSS library bug using 'try' catch': All right, let's fix this bug. The first thing we have to do is come back to our android emulator and completely uninstalled the app that we've just put in so we can come to settings APS and when that's loaded, we can scroll down and we confined our RSS feed. And when we click that we can then clear data, we could also uninstall it. But if we clear data, that should be enough. And if we try to run the app again, we should just get a blank screen. Now back in Android Studio, Let's look at what we've got here. We've got get feed items, and it's this that's causing us some troubles. So we have a few options, the first of which is to validate this feed address. And now this feat address comes from when we initially add our feeds into our app on our add feed screen here. And if we put a wrong address in there, we get an error much later on. Now our options are toe. Either fix the error here and make sure the feed is actually a feed. That's one option. The other one is to create a new line here that checks if our feed is correct. But in both cases, well, the first case when we do it on the ad screen, What if the feed doesn't exist much later? Wrong. Well, then your APS going to crash anyway, and the user is going to blame you as the developer for the crash, so that's not a good option. The second option putting a line here that checks the feed has a slight problem with it, and that problem is that we have to download the feed to check it. There's no way Teoh easily check. It's valid without getting it. And then we have to download it again to pass all of the items inside it. Now that's obviously wasteful. So there's a quick work around we can have for this problem, and we can surround all of this with what's called a try catch statement. Let's have try open curly brackets and then put all of this indented by one tab and then close your curly brackets. And then underneath that we have a catch, and in brackets exception E open and close curly brackets. So what a try catch does is it captures those errors that happened and it comes down here. And instead of crashing your wrap, it does what you've written inside here in the catch statement. And so in this case, we're going to inform the user that their feed is not working and then allow them to make the decision whether or not to delete it. So in toast make text up here in our own era, we're going to cut that line, going to drop it in catch, delete the two comments, and it requires a context, so we'll give it this on the text. Part of it is going to be e dot get message because he's part of the exception and the message part tells us exactly what went wrong. And then we give it a toast length and we show it. So now if we run that and we get an error, then it'll just drop us a little toast to let us know that we have an error. So let's put that into our d bugger. So here's our app, and nothing's happened. And that's because we currently don't have any feeds active, because if you recall, we wiped the data from the APP, so Let's put a fake feed in. Let's call this www doctor fake feed dot com and let's save it and quit out of that screen . And then we need to have a look it down here and it gave us an error message that was a little bit too short to see. So let's come back to an drug studio, stop it running and increase the length of that message. So in the catch exception, let's make the length long. There we go and let's run it again in the deep Bugger And there we have addressed, not frowned. Www fake feed dot com. Okay, that's great. That is perfect. Now let's go back to wrap and let's add a really feed into our list of feeds. So I've hit Plus, and let's pick up a BBC news feed and we'll call this top stories. On the address for that feet is http feeds dot BBC i dot co dot UK ford slash news ford slash rss stopped XML And now when we say that and we go back, that should be added one by one to our list of feeds and the surefire way to check that is to come back to our android studio. Stop it running on inside here. Inside, I'll get feed items. Let's just send ourselves a little message and say Log Dr D. And we will say Fightem received. And then we'll say what we've received so that would be items dot get all right dot get title. And that will just drop us a little message inside the debug version off a rap that says exactly the items that we've got and that will pop up on our android monitor here and it's now running. And if I hit our android monitor, we have item received and a whole bunch of news stories. Okay, let's stop that running. And now he fixed that horrible error, and we fixed it in a sustainable way. I like Teoh to think of these things in, and that means that in the future, if all of the addresses change, if something goes horribly wrong or something has a crazy way of doing things, then we've set up our app so that it catches sort of the base of that pyramid if you like. If we had set up era catching in our ad screen or if we'd done it up here, then we would have left ourselves open to errors. That could happen if it passed those two checks. So what we're doing is checking that we can actually get the actual RSS. Now that we have our feeds all collected in the next section, we're going to look at actually putting those feeds into our list. 24. Placing the collected feed items into our list view using an adapter on Android: All right, let's put these feeds into our list. And before we go anywhere near the list, there's something insidious happening here that you won't realize until it's too late. And that is every time we get a bunch of feeds from a feat address. We run this function now. At the end of this function, if we had code to make the list view, it would work, and but it would keep populating our list view. So every time this was fired, it would have to create a new list view, which isn't a very efficient way to do things. So what we're going to do is we're going to make a variable that keeps track of exactly how many feeds we've passed. And once we have them all, then it's going to create our list view for us. So to do that, we need to create a class level variable up here, and there is going to be int feed count and then down here in our own create method, we're going to set that feed count. Feed count is equal to RSS feeds, don't sighs, and that just gives us the number of feeds we have to work through, then we're going to have another variable up here, and this is going to be int retrieved feed count. And if we come down here, we are going to set this as zero because we don't have any yet. And so later on, we want to compare, feed, count and retrieve feed count. And when we're when they're the same, then we're going to fire up our list view because that tells us we have all the feeds now. To do that, we need to come down here for when our feed is successful and we need to add 12 hour retrieved feed count. So we say Retrieve feed count plus plus, and that adds one to it. And if there's an error inside our past to call back, we also need to do it here. So we say retrieve free count plus plus. And finally, if there's an era inside this big try statement, we also want to have it inside the catch. So we'll say retrieve feed count plus plus, So whatever path this get, feed items goes down, we're going to add one to retrieve feed count, whether it's failed or succeeded or had an era in passing. Then down here at the bottom, we're going, Teoh, do a comparison, and we're going to say If the retrieve feed count is equal, equal to the feed count, then we're going to do something. And what we're going to do is we're going to fire up our list view. So let's call this populate list view like So now we haven't created that yet. That's why it's red. So let's come down here and type public void populate list view. There we go. Okay, Now, what we can do is we contest that this actually works. So up here, when we compare the two underneath, we're going to send ourselves a little message logged up D on. We have to give this a tag so we can call this feeds retrieved, and then we have to give it a message and we'll call this got all feeds. Here we go. And this is just for us as developers to check that this logic is a working. So let's fire that up in our app. And here it is. And inside my app, I've actually added another BBC news story from the world. And if we come back. 200 studio click on Android Monitor. We have item received away up here. Item received. Item received. However, we don't appear to have fired our feeds retrieved. So it appears to be not working. And this means that somewhere we have a very small bug where we're not comparing things correctly. So let's stop that running and look at our code a little more closely. So let's look very carefully at I'll get feed items. So we passing a feat address, it gets passed. If it's successfully retrieved, then sorry. Then we fire up this and it increments are feed count by one. Now, if we go through this, if you think like a computer, it goes through this line by line and it only fires this much later on when it's got the feed. And whilst it's waiting for that, it continues with everything down here, and it also continues, especially with this check section here. Now, that's a problem, because we haven't yet retrieved a feed yet. We're coming down here and we're checking if we retrieved it so that Final One never really gets added for us to check it here. So we have to move our check. Teoh here on. We have to check it here, and we most likely have to check it here in three places. So, of course, the efficient way to do that is to make another method and to move everything into our populate list view. So what we're going to do is we're going to remove this populate list view here. We're going to move this whole check control X into populate list view, and we're going to make some space inside the If So now, if everything is equal, then we can go ahead and populate our list for you. And of course, we need to call populate list view at each of these points here. So populate list you populate list view and populates list view. We could go one step further and take this retrieved feed count, which we will do, and we will put it inside populate list view. And of course, we have to remove it from all of these and then an hour code is a lot more neat. We just have one method that we're calling inside each of these sections, and when it's cold, it adds one to retrieve feed count and then checks if these two are equal. So let's save that and run it and check if our log tells us that all the feeds are retrieved and there we have it. All of our items are received and down here, it says, feeds retrieve bottle feeds corresponding to this line here. That's great. Now we know that that works. So let's stop that running and let's actually get on with creating our list. Let's first create our list view adapter. And if you recall from an earlier lesson, we had our RSS feeds adapt to set up here and all that had really inside, it was one method called Get Few. And of course we're going to do the same. So let's right, click New Java class and we'll call this feed item adapter, okay, and then we can use this old one as a template. So we can say this extends Honore adapter. So it's simply a case off copy and paste and this is our excess item type. And of course, it give us an error because we haven't yet put in our various bits and pieces that we need , So let's go ahead and copy all of this code and change it for our own use is inside feed adapter feed item adapter. So it asks us if we want to import some stuff, just click OK to all of those. And then we have to change some things. So we have to change the class name and this into that. And then we have to change all of these RSS feeds to RSS items. So RSS item and we will call this item equals get item position then in our layout inflator , we don't want the edit feed item road. What we want is a different row and that one for us, if I can remember, it was RSS feed item room and then we have our text views down here. So let's change what these air called. So there's no confusion. We have text for you called title, and we will have a text view called Description and in fact, let's open our draw our layout folder and let's be sure that we're getting these right. Let's open up the RSS feed item road and if we switch to the text view, our first text view is the title text view on its I d is RSS feed item title text view. So we want to change this RSS feed item title text view. Then we want the description one that one. Waas, where's our i d RSS feed item description? So we changed that to RSS feed item description, text view and then down here, there's change these variable names to title and description and of course, we don't have a feed. We now have an item and an item on. Then we have to give it the title. So item dot get title and the description item dot Get description and then we returned the view and now we have one error here and that's because we have passed in some RSS feeds and it should be RSS item and we will call this items and then the same in here items. Okay, There were no more errors. That should be our feet item adapter completed. Let's close the road and close the feed item adapter. And then in our main activity dot java, we're ready to set up our list view. So first we have to get it from our layout. So list view list view is equal to a list you and find view by i d. And that's our dot i d dot And then it was a list view. And there it is. RSS feed item list view that should be the correct one without checking. Then we have to give it an adapter. So we simply say list view dot adapter set adapter. And then we have to create our adapter in there. So we say we would like a new Let me just recall what it was called a feed item adapter, feed item adapter. It asks us for a context. Let's type this and then it wants the items that we have. Now, if we scroll up, those items are actually in an array list, they're not in the list. So if we come back to our feed item adapter here, we want to change this list, too. An array list like set, and it will ask us to import something. So let's go ahead and do that. And that should now all match up. Go back to main activity, scroll down and let's get to our set adapter this and then we're going to give it the's RSS items. RSS items okay. There were no air is showing up, so fingers crossed. Let's run this in the deep bugger and see if we get a list. And there we go. We now have a big scrolling list off all of our items directly in there. Isn't that great? That is fantastic. Okay, in the next lesson, we're just going to beautify this a little bit. So we're going to make this title text much larger, and we're actually going to take away this image, I think because I don't think it adds anything on what we're going to do is a little trick that I've learned in previous APS that makes them look really good, but is very minimal on resource use. So I look forward to teaching you that in the next lecture. 25. Making our list look good: All right, so we have our list off feed items Now. This image at first was a good idea because when I started this project, I thought most RSS items came with an image, and some do actually. But it's quite a pain extracting them and placing them in here. And it has, ah, very large bandwidth overhead. So you don't want to use up your users data. So we're going to do an old trick that I've done before in other APS to make it look really good, but for a really low amount of bandwidth or data. So come back to Android Studio and let's fire up that feed item wrote that we've just been looking at. And so here we have it. Now we're going to remove this image view. So let's just go ahead and delete that and switch to our design view, and we're just going to drop in a large text right on the side if we can. There we go now. If doesn't quite line up, you can grab the other ones, and you can kind of shuffle them around until they all line up there. But I always find it a lot easier sometimes to do this inside the design of you. So there we go. I can squeeze all these together. So in the large text view, we need to give it a width and we don't want to wrap content. We actually want this to be about 65 DP wide. That should do it. Then let's shift our title text view across a little more. Here we go. The other thing that stands out to me is the title text view isn't very large, so let's go ahead, scroll down to our text size and make that. Let's see what 20 DP looks like. There we go, that's a little better. And then I'm actually going to make this description a little smaller. Let's see what 12 looks like. Okay, that's not bad. I'm just going to increase the size of this text to fill in to see what it looks like when we have a lot of text. Okay, let's give it all a little bit of breathing room at the top. Let's click the background element, which is our relative layout. Police scroll down. We can give it a bit of padding at the top. Let's say actually, let's say of eight DP, and we can do the same for the bottom again, let's call this five DP Okay, now you'll notice everything's gone a little bit squashed. So we just have to kind of drag and shuffle things around inside of here. And if it doesn't quite listen to what you're saying, then come over to the Properties panel and you can manually set the height. So let's call this 1 60 That hasn't done anything. Let's say 40. There we go. That's a little bit better, so we can see if I hover over it. We've got a large title text on this text underneath it, Okay, it's almost there, but not quite. What I would like to do is actually increase the height off my relative layout. So let's make it 90 dp and we go. That's getting better. And then let's increase the size off the description view. Let's call this 46 and that pushes everything up a little bit. That looks much better now. Now this large text section. Let's go to the text view on Let's give it on i d. So where is it? It's down here at the bottom large text. And I want you just to put a big accident as the text and then the i d. We want to call this are Isis Feed item letter, text view. And the reason for that will become clear in just a little bit. Okay. And then, of course, if we have some red squiggly lines, we have to fix that. So copy this. I d and put it up here where it expects it to be because everything is placed relative toe one another. If you recall. So expect your design view. Okay, Now we have an X and then that's great. I would like that X to be in the center of its box, and we do that by scrolling down in properties, coming to gravity and clicking center, vertical and center horizontal, and that drops it to the center. Then let's increase the size of that a little bit. Let's say 44 see what that looks like. Okay, I think that looks pretty good. Now, let's say that and let's switch to our feed item adapter dot java. Now we're going to pull out that text view. We just created the large one. So where we've declared all of the others. Let's do the same text view Large letter is equal to Sorry text, view, convert view dot Find view by I d and then we have to go find it dot rss feed item on. Then we have it. There are six feet item. Let a text view then where we set everything. Let's set large letter Don't set text and we will say item darts get description. Now of course, that's going to give us the whole description and we don't want that. Sorry, we don't description. We actually want title, So just delete that and say Get title now. We don't want the whole title. What we want is just the first letter off the title and it's quite an eye catching thing to do to have the first letter of your story as a very large letter. So we just need to grab the first letter out of this and we do that by typing dot sub string and we have a few options for start and end. We want the 2nd 1 sub string, and we've given an index to start with. We want the 1st 1 and he wants an end, which would be the 2nd 1 which is one in zero based indexing. Okay, let's fire that up inside our simulator and see how it looks. And there we have it. Doesn't that look good? It's very eye catching now, and it kind of makes you want to keep scrolling to see things. And of course, we have a suit. A few cities here, like if there's an apostrophe, it'll show that. But that doesn't really matter. I don't think it really detracts, Okay, there's one other thing that bugs me. And if you look at this second story at a glance, there's a little bit of a line you can see there. And that would be the second line of this title. And we can fix that very easily. Come back to Android studio closure debugging. Go to RSS feed item row and click on your title text view. And if you scroll up your properties, we should have Max lines. And of course, we just want one. And now if we save that and fire it up, that should have fixed that problem. And there we go. That problem has now gone. Okay, that looks great. And I think part of your homework actually, guys is I'm going to get you to change the color of these to a random color each time to give our up a little bit of life. Okay, In the next section, we're going to look at wiring something up that allows us to click these stories and opened them up inside a new screen. 26. Creating our RSS item viewer using a web view: Okay, guys, we're almost there. We just have one final thing to do, and that's open up a page that shows us the full story whenever we click one of thes news feeds. So come over to Android Studio and let's do that. Now. The first thing we have to do is set our own click listener for or list view. So we type list view darts set on click Listener that we say new on click listener like Set , and it creates everything for us. So in here we need to create new activity to send Item two like that. So we're going to do something in here. And the first thing we have to do, of course, is create the activity that allows us to view this item. So let's go ahead and right. Click our com line, click New on Activity Blank activity. And if you recall we've been through this screen before, let's give it a name, Let's say RSS item view activity. Yep, it asked for layout name. So our society vic view, excuse me and then a title for it. We can give that whatever we like. We might change that. Actually, in the program and ask us for a parent. You want that to be the main activities. We can click back and click finish and there we go. That's created our view. Now, as usual, it's actually created two XML items. One is the activity RSS item view and one is the content RSS item view. We were editing the content one. We want to remove this fact button which is actually in the activity RSS item view. There it is. Let's go ahead and get rid of that and save it. Then you can close that one. Okay, now we have a basic layout for our content. Orissa's item view in design. We need to find something suitable to show this story. Now, if you recall, each story has a link that goes with it that will open up a Web page. And in Androids we can use a widget called a Web view so I can drag that straight into here . And we have now have a Web view. Let's go 12 text and change some of these things. So let's have the width as the full width of what we have match parent and the height as match parent then in the parents. Let's remove thes pad ings because we are used to seeing a Web view as the entirety off the entire view. We don't normally see padding in it, so in this case we removal that. And now the Web view fills up the entire screen. We have to give it an I D. Of course, and we should name it something like RSS a few item Web view. Okay, let's save that, and we can go ahead and close that XML file. Now we're onto our RSS item view activity dot Java. Let's remove the floating action button because remember, it doesn't exist anymore. There we go. And then in our own create, let's find that Web view. Let's say, where've you Web view is equal to Web view. Find view by i d r dot I d dot I'll just start typing Web view, and it should find it. RSS few item Web view. Okay, now we have this strange red color here, and it says it cannot resolve symbol, and that's because I've made a silly era. I've put brackets around this Web view. Andi, I don't have to. There we go. Okay. A Web view takes in a U R L and then shows you a Web page. So now we get to the nuts and bolts off most android app applications. And that is how on earth do we pass data between activities? Because you need to think about activities as separate events or containers for things that are happening. And there's a special way off passing data between them, and I'm going to show you that. So come back to your main activity dot Java, and I just realized I've made an error and the ERA is here in listsview dot set on click listener. It should be dot set on item click Listener and you've got to watch out for this and Android. It's quite a common mistake. So let's delete everything from that and just leave list view dot and we will have set on item flicked listener and we will have a new on item click listener and that will create everything we need for us. Okay, now we're going to inst enshi eight, our new activity simply type intent, intent. It's equal to a new intent. We have to pass it this class. So we say main activity dot This and then it asks us for a new activity we're going to open . And that is going to be RSS item. Few activity dot this now. Sorry. It should be docked base. It should be dot class rather there we get now we need a way to get the item that was clicked in our list. So let's say RSS item item is equal to our list of RSS items we created way back when don't get and we will get the one at the position pasta in from the item in a list you that was clicked. Now we have our item. Then we have to pass the u R l from that item to our intent. And the way we do that is intent dot put extra and then it asks us for a name for the string, so we will cool. It's very simply you are l. And then it asks us to put in another value and you can see a whole selection off them. Down here, there are many things you can do something. It's very interesting to look at Is the past level value that's very handy. Later on, when you're creating more complex APS. But for now, we're only passing one string and that will be item. Don't get link that actually passes a u r l So we need to convert that to a strength. And to do that, just type dot to strength on in that with your semi colon. Now you've put a you earl in a little package that the RSS item view activity can pick up. Finally, all that's left to do is to start the activity with that intent and save that now, in your RSS item view activity, you have to have a way to extract That's you r l We just passed in to the package set and it's fairly simple. We say this Dr intent or get intent, don't get string extra and then we give it that key that we used girl put a semi colon. And of course, let's assign this to our own variable string you are out is equal to they start getting tent, etcetera. And all that remains is to load up that girl inside our Web view, which is really easy to do. We type web you dot load you are l. And it asks us for a string and we just give it the U R L. Okay, let's fire that up in our emulator and see if it works. And here we are and let's click something. It's click Osborne, you turnover tax, and that should open up a another activity with a Web view embedded in it. And we can scroll through that Web view and see what we want to see. Now you'll notice it's automatically gone to the mobile version. We can change that, but we won't for this tutorial. The one thing we are going to change is this title, because we can't really leave it like this. So let's come over to Android Studio. Stop running the APP, and then let's set this dot set title and we will just call this story. Well, actually, that's coolest RCIs item. There we go. You could do something more fancy. You could pass the intent, a string that was the title off the story and set part of that as the RSS item. It's completely up to you, but as you can see, it all works really well on the way that we expect it now. In these Web views you have to know there is no navigation. So if I click something, it's going to open in the Native Web browser for a start. And if I click back, it should go back to my app. Slowly but surely, Andi, you cannot go back and forward in Web pages in the Web view, unless you explicitly tell it. That's what you would like so you can create your own buttons for backwards forwards and reload, etcetera. 27. General monetisation strategies on Android: So now that we have a good looking at, we need to make some money off of it. Now, if you're a freelance developer and you've made a nap for someone you've already made your money. Your part in this is more or less over. Unless the person that hired you wants you to make some more features for his app or to put ads in for him or something like that. The question is, if we have our own app, how on earth do we make money out of it? Well, there are a couple of strategies, and the 1st 1 is to charge for your app. That is the most obvious. And if you have a good app like Kingdom Rush, which is on the iTunes store, they charge $5 for it. And they have had a lot of success with this Siri's. But with that, you need to have marketing. You need to have a very, very good app that sells itself just on screen shots or on a preview video. At the moment, we don't have this level of app, so that is kind of out for us. If we had an exclusive contract, say with the BBC to publish their RSS feed. Then you could charge for your app because you have something unique that people want or need. As it stands, there are loads of RSS APS and we're competing in the marketplace of free. So the next strategy is to create a free app and then charged for extra features. So within our app, we could charge so that people could read things off line. Well, they could save things or they could share things on and again that does that extremely well. His clash of clans Everything is free to install. But if you really want to get ahead, then you have to pay for in APP purchases. And it's so successful, even got Liam Neeson to do a video spot for them. Some maps combine these two features so they charge for the app and then they also charge you for extra features, and Minecraft is one of those. You pay £5 for it, and then you can also buy things inside it. So again, you need to have a top up to do this. But interestingly, Minecraft only has a 1,000,000 reviews. Clash of clans has near enough 20 million, so free is a big motivator for people to download. However, it's different between the android and the Apple stores. Because android users expect a lot more free APS Apple uses. Expect more quality. So if you want to charge for a nap, your best bet is to actually create it for Apple. First, try it out there so you'll know if you'll have success on Android charging for it or not. Okay, then. Our third category is in APP advertising, and I don't need to show you examples of this cause. I'm sure you've seen it all over the place. This is where the APP has a banner that comes that pops up at the bottom of your screen. Or it has an interstitial, which is, Ah, whole page at advert. Sometimes this can be very annoying for users, especially if you plus to them everywhere. So it's a balance between annoying your users and making money from your aunts. In the next section, we're going to look at putting some non intrusive advertising into our app. Finally, you could get sponsorship, and that's just fancy advertising because you go direct to the person that wants to advertise. Let's say Nike and you say I will put your shoe advert inside my app whenever someone clicks on a shoe story. And that is worth gold to most, uh, companies, because that's really targeted advertising. And they will pay 10 20 times more what they pay Google. So that's an option. But it's only one to consider if you have a specific customer base. That's a for example, like shoes. Now, anecdotally from my experience and from reading about other people's experiences, Charging for a nap works If your app is unique, ours is not free. APS get downloaded a lot more than APS that a charge for the top nine out of 10 APS in both APP stores are free APS some of those use in APP advertising, but most charge for extra features. But bear in mind, that's just the top of the APP Stores were gonna be way further down, and we need something that puts us in people's faces and makes them download around. So we've already done that by making a good looking out, because that is most of the battle. As for how much money you can make out advertising, I would say if you had about 100,000 daily users, you could make 6 to £7000 per month in advertising sponsorship. The sky's the limit that is done on a deal by deal basis. So for our app, we're definitely gonna go with in APP advertising. 28. Getting paid via Google Ads (AdMob) on the web view page: All right, let's sign up for ads, and you first have to go to add mob dot com. So add more dot com and that redirects you to add more by Google. Then you have to sign in or sign up. If you've got a Google account, it'll be pretty quick and painless, even if you don't. It's also fairly quick and painless, so I'm just going to sign in. And once you've signed in, you come up to this menu in the top left, click, monetize and then monetize new app. Then you can either search for your app, and it will search the APP stores if it's already published. But we have to add our app manually, and I'm going to call this out our access or personal RSS Reda. He asked for a platform Houses on Android. When you click, add, it will ask you what format you want. Your Adan. We want a banner for now and leave these options as default. The refresh rate. I've done a lot of research on this, and it is best to leave it at 60 seconds. Lowering it may make you think you have more impressions, but you generally have less income from it. But I'd advise you to go out, and that's just check that or test it within your own app. And then give this a name So we will call this Web view Diana Button like so And then when you save it, it's going to give you an ad unit, I d. So we're going to copy that I D Command see? And then we're going to use that insider android studio to place ads so back to Android studio and within our project where it's his android. We want to stay on that and down here in grade all scripts there to build dot grade ALS. One is for the entire project. One is for our module app. We just want the AP one for now. So double click and open that now if you recall earlier, we used this jar file for our project and you can see here it's included it in a dependencies. Well, we have to do the same for the Android Play services ads, so please type compile single quote com dot google dot android docked GMs semi colon play dash services, dash ads. And then we give it a version. Let's get 8.3 point and save that, and at the top it gives you a warning message. Grade. All files have changed since last project sink sink may be necessary. So hit sync now and that's little synchronize Fine. If you can't see that warning at the top there, if you can't to the top goto file synchronized, you can also do it in that. Now that it's complete, let's come back up to our app and close that build Breydel and then within our app, let's run our up inside the simulated just to make sure that it builds. And there we dio everything builds fine. And if we come back 200 Studio checker Android Monitor, Check this. Everything is okay. Okay, now just a word of note, I'm not sure yet, but if our ads don't show on the simulator, that's not a major problem. I'd advise you to get a real device to test Anson, but we don't know if that's going to be the case yet, so let's carry on. Stop that running. And then let's open up our project values and strings because in here we need to create a new string that has this value of our ad unit I D. So we're going to call this string name is equal to Web view under school banner at under School I D. And then, of course, we just paste in that. See a number there. Say that and close it, Then expand layout and let's get our content RSS item view. The XML opened right? So underneath Web you were going to insert a special element called an ad view. If we click on design, I don't think we're going to find it in here. But I could be wrong. No, I can't see it. So this is when we actually to start manually typing ad views. Fresh type, come dot Google and there we go. We can see it's already popped up with a suggestion, and that 1st 1 is the one we want com dot Google or Android GM Esther ads not and view. It asks us for a width, and we will wrap the content for that. It asks us for a height, and again we will wrap the content on then percent there. Let's give it a few more properties. Let's center it horizontal so we want Android layout center horizontal and we want this to be true. And then we want to have it at the bottom off our view, not at the top because where it is now looks a bit naff. So let's have a line parent bottom. That's true, and that will drop it to the bottom. Ignore the fact that goes behind the buttons for now. It won't in our actual app. Then we have to give it in ads at sighs. Sorry size. I've got a dodgy said Key on this keyboard is equal to Bana and then adds at Unit I d equals two and we have to pass it. The string that we created for our ad i d. So string slash. Where've you banner at? I d Okay, let's say that and there's one more thing we have to add, because this ad says name Space adds, is not bound, so we have to explicitly bind it. So at the top here in our relative layout, decorations were going to type X m l and S colon ads is equal to, and we have to point it to http and then it gives us a few options there. Schemers android dot com Rez auto. I think that's the one we need bet and now adds, is fine. And there's one other thing haven't put in here. And that's the I D for ad view. So android i d. I. D. Is equal to act. Plus, i d ford slash on. Let's give this the name of RSS item. Add view and save that and then close it. Then let's open up RSS item view activity and inside on creates underneath the load. You are l We're going to fire off this ad, and the first thing we have to do is find our ad view, which we will call ad view. It's equal to add view. Find view by I d r i d dot Add a few RSS item at you. That's it. Okay, it's just open up our import and check that it's automatically imported our J mester ads. Start add view. We also need another one of these, and we have to be careful because there are two versions. The version that we want is the following dot at request. Sometimes android studio defaults to something like com dot gov had requests something like that, so you just have to watch out for that. So it's best to explicitly set it right down in our own create. On the next line, let's make a request for around ad request. That request is equal to a new ad request. Don't dot builder don't filled. So that creates a new ad request and it goes over to our XML file and checks what we want. We want a banner and it goes and get that. Then we have to load it. So we say Add view, Don't load ad and we pass it the request. We just made ad request and that is it. Let me just close these messages. So let's fire that up in our simulator and see what it does here. It is ready to go, and now let's click a new story and let's see what happens. We open up our Web view and at the bottom great. We have a test banner and we have a test banner because Android Studio knows this is a simulator, and it's against the admiral terms and conditions to have riel life ads whilst or developing. So just be careful of that. Also be careful of the fact. If you click your own ads, Google will suspend you or even ban you if you keep doing it, so just don't do it. It's not worth it. Okay, so let's go back. And whatever story we open, we should get the same banner that pops up. That's great. Now, just a word of warning. If this runs on a tablet, this banner will be almost the full width of the screen, and it will be 90 high, so it's going to block quite a bit of your Web view. If that's not a problem, then leave it as it is. Alternatively, your users can come down here and press the X button when it pops up to clear more space. 29. Test, test and test again!: Now, the final thing I want to talk about is, uh, debugging and testing. Now, I cannot stress enough how important this is if you have a nap. That's really simple, like this one. But it doesn't work on 40% of devices because of a silly bug. You're going to lose a huge possibility to make profit. So you have to test, test and test again. And in my experience, testing is about 50% off the entire development process. It really is that much because you're testing as you're going through. And then at the end, you're going to load this app on some of your devices and you're gonna walk around and you're going to see the little bugs and things that would come out over time. That would really annoy you. I'm going to give you an example of one here on if we fire up our main activity up at the top in on create what happens if we have no Internet connection? Well, let's see. I'm going to disable my wife, I and then I'm going to fire up the and here it is on its blank, and there's been no message to tell me that it's the Internet's fault, so your user is going to assume that it's your fault as the developer. So that's going to be part of your homework assignment. I'm going to fix that myself before I release this app. But in your homework assignment, I would like you to add some kind of line in here to check for Internet connection, and in fact, we need to move this line two before we start calling these Get RSS feeds. So in here, you're going to check for the Internet connection. Then, if there is no connection show, use that a dialogue that allows them to try again so they can click. Try again when they do have a connection, then if that works, then allow them to get the feeds. Now, this is quite a complicated problem if you're a beginner, but I would say work through it slowly and methodically, like we have with the rest of this. Okay, back to debugging. Now, The main thing you're going to use when you're debugging is this line locked up D because that allows you to connect the android monitor and see what's going on. So in here it's got some ads for me and it says there's an ad visible, not refreshing and scheduling an ad refresh 60 seconds from now, which is the settings that we had over here in our ad mop, if you remember. So wherever you can, I want you to use log doc D to tell you what's going on and this will be absolutely invaluable for debugging. Okay, that pretty much sums it up for debugging. And that is our app pretty much complete. Now I'm going to make a few changes to this app to make it more in line with the way I think it should be. I'm not going to cover that in this course because they're a little more complicated and involved. And I would like you toe actually debug this app and add new features in the next section, we will look at preparing our app for release. So app, icons and also signing our app and signing is a complicated subject that people make too complicated and I'm just going to break it down very simply for you 30. How to create an Android app icon: Let's design the icon for our app. And before we do, I'm just going to point out something here. And that is we have about 25,000 unique android devices in 2015. That's 25,000 different screen sizes, screen densities, screen shapes, even on screen. I don't know, pick a parameter. They're all different now. Android takes care of this by looking at the density off a screen so it looks at the screen and says if it has 120 dots per inch, it's low density and then up 260. It's medium, etcetera, etcetera, until we get to the really high density, which is 6 40 And it says for each one you need to have a Nikon sized all of these different sizes. Now that's a bit of a pain to create an icon and then resize it for every single one. There is an alternative, however. You don't really need to go through that if you don't want to. You can just have one single image at let's say, 192 pixels, and then the android system will take and use that image for all of these densities, but you will have to rely on Android scaling it down. So again, once you've made your image at this one single resolution test on as many devices you can to see what it looks like. All right, let's make our image. So I'm going to make a new Photoshopped document, and I'm going to make it one night to buy 192 Except now app icons need to be eye catching because they're the first thing that pops out at a user. And our app is all about RSS, and the icon should reflect that. So if I'm looking for a nap and I see an RSS icon, I know that is what I need. So let's use the RSS icon, which is free and open source, and I found a free version to use on Google, which is copyright free. I'm just going to scale it down and pop it into here, so let's get it to the corners. Okay, now let's remove the background on let's use the 12 to get rid of these white sections at the back off RSS icon. There we go. That will be your basic app icon and up icons supports transparency. So when this loads up on your phone, you won't see these four corners because they are now transparent. I'm going to take this one step further and where to change this icon into the colors of our app to continue our theme. So if we recall our primary color up here in our colors dot XML is this so I can just put that in to my color palette on photo shop and click OK, and now it's ready to go. And then I'm going to find my color replacement tool over here. Andi, I'm going to make a little bit larger. I want to start coloring in the various bits and pieces here just to give it a nice, consistent theme with our app. There we go. Now, if we like, we can also apply our green color. But I have a feeling this might be a little bit too much right click, OK, and then we fill in these white areas. So I'm just going to select my paintbrush rather my paint bucket and filling in these sections. And actually I think that looks quite good and it sums up how are apt looks in real life. So we're going to use that as our icon. Let's make it smaller so we can have an idea of what it looks like to the user. Okay, that looks pretty good to me. It screams out what it says now when are on your APP icon. You should never write the name of your app because it's going to be too small for users to read. The APP icon should only imply what the app is. Okay, set. Let's say that as a PNG I'm just going to drop that in my downloads and we will call this Icahn AP sorry, underscore icon dot p and G and we savers a PNG because that allows us to have transparency . Then let's go ahead and find that inside our finder or our Windows Explorer. So I'll just pop it up here downloads and we have it That right click copy. So it should be this one right click copy. Come over to Android Studio and drop it into drop ball with paste. It last you for a name and we will have the standard name. Then we open up our manifest and we assign our icon inside hit under application. So at the moment we have an android icon, which is this mitt map? Let's change that to act. Roble slash app icon. Let's save it and let's run it in our simulator. And here we have it inside our phone and there we have personal RSS feed. Now, to me, this icon doesn't quite pop yet, like some others do. So we're going to make a very small adjustment in photo shopped to change that. So back to our icon, we're going to select the Magic 12 and hold down. Shift on. We're going to select these green areas and once there will selected right click on click Layer via Cut, and that will create a new layer on the right double. Click that, and then we're going to do a drop shadow on them. I'm not sure which way we should have it, but we have to make this very, very obvious to the user because remember, the icon is very small. So I think perhaps we should have our drop shadow going that way and have it something like that. Let's click OK and see what that looks like small, that already looks miles Better to me. So let's save that icon again as the app icon dot PNG Okay, And then let's drop that copy and paste copy into our android studio and a trouble paste. Click OK, and over right. I think that will look a lot better. Okay, say that. And that is your APP icon. Complete it now. As I said before, you can, of course, put up icons at these various pixel sizes and that's going to make it look a little bit better then this one currently is. But I would advise you to actually put your time into designing a good app icon. It should scream what your app does. So I mean, look at these examples we have gallery. It tells you these air about pictures A gesture is someone writing on a pad. Settings looks like the settings icon, but with a google. So it screams at you what it does 31. How to sign an Android app for release: right just prior to release. We have to sign our app with a key store, and I'm going to explain what a key store is. Very simply, let's assume you have you. You have a nap that you've made, and you have all the money that you're making from that app. Let's say from advertising What happens if someone on the Internet gets ahold of your Google account and your password? Well, theoretically, they can just upload their own version of your APP. They can put their advertising code inside it, and they can take all of your money. And we obviously don't want that to happen because names and passwords get stolen quite frequently if you're not careful with your PC. So the solution to this is to sign the APP. And if we have something called a key store, which is basically just ending an encrypted file on your system, you use that to sign the app, which makes it secure. Then, if the bad guy comes along with your Google name and password and signs in and tries to replace your rap with his own one, he can't because he hasn't used the key store that you have on your machine to sign that app and that means all of your revenue is still protected and your reputation as a developer The important thing to remember is that this key store is the key to updating your app. If you lose this key store, you cannot update your app. There is no way around that. You'd have to create a brand new listing for it. So always keep the key store safe and back it up. But do not back it up. Obviously with your Google name and password and so coming back to our app, we have already signed it with the key store. But we've signed it with a debug key store when we ran it on our simulator or on our device . So we have to learn how to sign it for release. So to make it a public listing come on over to Android studio Close android manifests come up to the top to build. And then we are gonna Jane going to generate a signed a PK. Now, when you hit that, it asks you for the module and in our case, it's app. Click Next. It asks you to create a new key store or to choose an existing one. I'm going to choose on existing one, and so I have one tucked away. Actually, I'm going to create a new one in this case because my existing one is on my other computer . So let's create new and it asks us where we want to store it. Well, it doesn't really matter at this point. I'm just going to pop it into downloads, and we have to give it a name. So let's call this or is this feed key store? The file type is J. K s. And then we have to give a passwords to the entire key store. So obviously I'm not going to tell you this, and you can have whatever you like. Then we have to create a key. So let's make this alias something that's obvious. So we will call this personal RSS under skull feet, and then, of course you need a password for it, and then a validity time in years. Android says at least 25 years. What? I just like to set mine too. 50. Maybe I'm just hopeful. Then a first and last name. You don't really need to fill these in, so I'll just put these in blah, blah, blah and click. OK, so now you've created a key store and a key, and I'm just going to remember passwords on my machine because it is secure. And now I've hit next, and I have a slight problem. Nothing's popping up. There we go. I've just managed to fix that. It's a very annoying thing on Android on 100 studio that puts this directly behind here so you can't access it on. The solution I found is to switch to another application and then come back to this one and then grab it and drag it off because it should be on top at that point. Okay, Now we can carry on with our signing. It asks us to set up a master password on. That is probably because I've clicked, remember passwords. So I will indeed give it one. Okay. And it asks us destination folder for our app. Well, I would like to put this just in my downloads for now. That would go. It asked us for a bill type. So far, we've bean debugging, but we want release, cause we're gonna put this out in the wild. There are no product flavors on. And if you want to know more about that search Google for grader build on, it will explain more. But it's quite a complicated subject, and we won't worry about it for simple APs. So hit finish and once that's done what it needs to do. If you look down here on the bottom left, it says, executing tasks and in the middle grader build running. So we just have to wait for that to finish. And once that is done, it gives us some nice messages. It says it took a minute and 1/2 to build it, and we've generated our signed APEC, and if you click, reveal and find out, it'll show it to you here in our downloads. Now in a peak E. A P K file is just a zip file, a different formatted zip file and it's this that you're going to submit to the Google Play Store 32. Creating a Google Developer account for Android: Okay, let's create a Google play developer account. Go to play dot google dot com, ford slash aps ford slash publish. And when you get there, it's going to ask you to either sign in with your Google I D. Or to create a new account down here. So I'm just going to sign in with my Google i D. And I'm going to put my password in. And I've just given myself on account that doesn't yet have a Google play developer account . And once that loads up, you'll see we have the Google Play developer console and it asks you to accept the license agreement. So click that and then simply continue to payment, and you will need to pay $25 to join the program, and you have to put in your car details, etcetera, etcetera. Once you accept and continue, it will ask you to complete some more details, and then you're ready to go. Once that's done, you'll be logged into a developer console press, add new application and then choose your default language and a title for it. Let's have personal RSS feed Rita or Personal RSS reader, and then click prepare store listing 33. Setting up a basic Android app Google Play listing: okay in your store listing. Let's set up a few details for a rap. So we have a title here, which is personal RSS feeder at reader. Sorry, we have to give a short description. I'm going to say really simple RSS feed reader. No fancy extras just pure. Or is this Read it Okay. And then you have to give it a more full description. So I'm just going to copy that for now. You can have whatever you like, and then I'm going to click, Save draft at the top and as we scroll down will notice there was some graphics we can add . I'm going to cover those in the next lesson. All of these graphics. In the meantime, let's come down here to categorization. Let's have an application type of applications category. Let's see what we need here. Perhaps news and magazines. I think that will dio, and then our content rating will be for everyone. It says you need to complete a rating question and apply content. Rating will tackle that later on if we need to. As for your public email address, don't show that to the public. Give them a different one such as this your company address and then privacy policy. You don't have to submit it now, but you can if you want to. If you develop for Apple, you have to have one. Okay, click safe, dropped and right at the top. Click a PK, and we're going to upload our first A PK to production. Once that's uploaded, we will see a little icon pop up here on the name of it and this identify a com dot DK micro dot personal RSS feed. And then down here we have a version number when it was uploaded on draft in production. It also tells you how many devices are supported. So, out of those 24 25,000 we support 9400. And that's mostly due to the fact that we're not supporting anything before Android 4.0, point three. So that just gives you a list of all the supported devices, and so you might want to just check in here that very popular devices like the Sony Experience at three are supported. Alternatively, you can switch off devices in here if you have major problems, so save that now that that's ready to go, I should tell you. You can also be to test where you can invite people or run a public test that's up to you. And you can Alfa test, which is the stage before beater. Okay, let's switch back to our store listing and let's scroll down. Actually, it's scroll up and up here. It says, Why can't I publish? And if I click that it says, I need to add all of these icons and graphics. I also need to acknowledge that the application meets content guidelines and complies with US export laws. You're saying to target the country and make your app free or set of price. There are many things we still have to do on the graphics. Ones, like I say, will come back to later. So for now let's click content rating. Click continue and then we need an email address. Sorry, I have a British keyboard. Acts gkp might grow doctor, come and then it says, Select your app category. Andi, Let's have referenced news or educational. Do we have violent material? No. There's no sexuality, no bad language, no controlled substances people can't interact, doesn't provide information, doesn't share the user's location and doesn't allow purchases. So save that it'll calculate your rating, which will be pretty much for everyone. And then you apply the rating and that section should now be ticked up here. Then we have to choose pricing and distribution. And, of course, we want a free app. If you want to have a paid app, you need to set up a merchant account. Click this link and Google will walk you through it. I went to select all countries because why wouldn't you? And then it says, Does your app have ads? You say yes. It doesn't have any android where things there are various other things. You can click Google play for education now we don't want that. And we say this application meets android content guidelines. Andi meets US export laws, So click save draft. Now I've read those documents so I know what I'm doing. If you really want to, you can read them. But basically, if you're not doing anything dodgy, then you'll be fine. Okay, click on store listing as it's the only thing that's left. So when I click, why can't I publish? We just need to add icons and screenshots, and that's is what we are going to cover in the next election. 34. Required icons and Feature graphics for the Google Play Store: Okay, let's create some screenshots off our app and the screenshots up here off phone and tablet are rather obvious. You have to create screenshots of your app, running on a phone or a tablet, and there are some rules. They say you mustn't show the phone or the tablet inside the screenshot, but they tend to ignore punishing you. If you do that so you can go ahead and do that and we're going to create their screenshots afterwards, the first ones we're going to create our this high rez icon is 5 12 by 5 12 icon, and this icon is shown in the Google play listings. So it's these along here. And if I click one, it's the icon that shown next to the listing when we have it open on or Google play store. So Google say that, yes, you need to have this the same as Europe icon, ideally, but you can also add a bit of information there to entice your user to download your app. So let's create that first, its head over to photo shop and creating your document, which is 5 12 by 5 12 and I'm just going to copy what we have in here. So I'm going to merge these and copy of him and then paste, and it's a little bit smaller than I'd like. So what I'm gonna do is recreate it from the image I had before and then show you that in a second. Okay, there we go. Let's save that as a 32 bit ping with Alfa because it's allowed to be see through, Let's put it as 5 12 icon save. And once that's gone through, come over to the play store and drop it in, and once it's uploaded, it'll process, and then we have it set there. If it's wrong, Google play will give you an error and tell you what to do to fix it. Then we need a feature graphic. Onda Feta. Graphic is Thean image that is at the top of your play store listing, so this is yet again another chance to entice your users in to using your app. So let's create a new document that's 1000 24 by 500 and there we go, because our app is so simple, I am going to make it a feature rather than lack of a feature. So I've said this is just a simple RSS up because no doubt there'll be someone out there that just wants simple. They don't want to share stuff. They don't want to do fancy things with their stuff. They just want the RSS So this might appeal to some people. Let's go ahead and save that and this one we will save as a JPEG because we don't need transparency for it. But I will call this 1024 okay, and then come over to Google Play store. Let's add the feature graphic one or two full, and you'll notice there are small blue stars here that say, We need to have these. Andi, on these, we don't have to have them. Okay, let's save that draft. And in the next lecture, we're going to look at putting some screenshots into this listing 35. Android app screenshots for the Google Play listing (aka, free marketing): and all that's left for us to do is to fire up some phone and some tablets. Screenshots se The best thing to do is to get a couple off phone and tablet images from Google. Let's go ahead and do that. Let's put a Nexus five in images, and then we can use search tools as labeled for re use with mortification. That means we're allowed to use these images again. So here's a nice one. Ah, although let's get a large one. I like this one. That's view of the image and copy it over 12 photo shop and let's have a new documents. And let's drop our phone into that. No, I just need to add some bits and pieces to it on some screenshots for our app. And to do that, we have to fire up our simulator and take screen shots from there. So come back over to Android studio, fire up your emulator and wait for that to begin. And so we here we have our simulator and let's take a screenshot. And on Mac, you can do command control shift four, and it lets you take a screenshot very precisely on Windows. You can't do that directly, which is a shame. But on Windows you can just do print, screen and then drop it into your Frau here. So I'm gonna drop that into here, and then I'm just going to expand its size to fill the screen on. Just jiggle it around a bit so it looks like it blends in. Okay, that's our phone screen shot for that section. Done. So let's say that as a J. Peg, we'll call this friend one before we save It is J. Peg, Let's check. And the Google Play store tells us that J. Peg or Ping with no Alfa. Okay, so we need at least two screen shots in total, so we will have this one phone one dot j Peg. Let's select it there it will upload, and then it's up to us if we want to add more and more. So what we can do is we can fire up the ad screen and weaken Drop that into so let's do my special screenshot combination. But first I will put BBC here, for example, w w dot UBC dot code of UK four slash feed, and then let's screenshot that and we get and dump that in there. Fill it out. There we go. Okay. Actually, I think we'll change our minds very slightly here. What we're going to do is we're going to put a little ribbon across here to really tell our users what this app does, and there we go. I've modified it a bit, and now you have no doubt about what this app does. Let's say that as a J peg and overwrite our phone one Dodge a pig. Okay, let's do the same for the other screen. So let's move all these layers around and including our text layer right to the top. And then let's change this text layer and then say simple to use. There we go. And then let's save that has thrown to Dr J. Peg and thats done. And then we cannot blowed it in here. It seems to have gotten stuck sums going to refresh the page. Now let's add our screen shot off phone one and from two. Now, if you look at this layout so far, even though we haven't seen it yet on the play store, everything looks coordinated and together the colors are all following a set scheme, even on the advertising. Marketing bit off the screen shots. And that is really important because users expect that these days. Okay, lets grab an image off a seven inch on a 10 inch tablet. So let's say Nexus seven to go to images and also a nexus 10. And there we go. I've put in a Nexus seven tablet, and all I've done is just changed the background really on. This is not the kind of app that you'd see on a tablet anyway. Some people might downloaded, but you'll probably get max 5%. So the phone one is the important one to get right here. And so I just dropped that in tow, or Google play listing for the seven inch on a 10 inch tablet. Now you come up to the top hit save draft and let's see if it allows us to publish. And it does. So when you're ready for your app to go Life, all you have to do is click publish. I I'm going to make some changes to this app because I think it's quite a good idea. I use our assess myself on those changes. I'm not going to list in this tutorial. Instead, I'm going to set them as homework for you to do 36. Easy Task - Validate feed name: okay. If you recall if we entered an address that was too short and we click save it would tell us the address was too short. I would like you to do the same for the name of the feed. So if I enter a name that's too short, it will tell me the name is too short. 37. Intermediate task - Validate RSS address: now for your intermediate task when we enter name that's just being checked by your previous task. When we entered an address, our app never checked that address. It only checked it later on when it went to retrieve the feed. What I would like you to do is check that this is a valid Web address and there are two ways you can do it. One you can look at how it's structured. So does it. Start with www or http. And to the better way, in my opinion, is to actually connect to the Internet and validate the address. So you're going to use some kind of http client and you're going to send the address out there, and what you have to do is listen to the response that comes back from that client and that will tell you if the address is valid. 38. Intermediate Task - Arrange RSS Items by published date: The next task I wanted to try to undertake is concerning this list on the main screen. I would like you to make this list ordered by published date. So I'm just going to give you a slight hint for that in main activity in populate list view . Once we retrieved all of these feeds, Then when we set our adapter before we pass in our feeds our RSS items rather so here in listsview dot set adapter RSS items before you do that in here, I need a line to sort RSS items. Okay. And you're going to sort them by date. Now, recall we haven't actually assigned a date to them, so if you scroll up to our get feed items, let me just close this. We've set a title, a description and a link, but we haven't actually set a date. If I type item dot set, there is no date in our item. So the first thing you have to do is go toe RSS item and you have to create new variables toe hold the date and new methods toe access, and set that date. Okay, That's quite a long winded task, but it's fairly straightforward. 39. Hard task - Create GUI to choose individual feed stories: in this task. I would like to have you put a button on the screen somewhere on the main screen, and when I click that button it will present me a list off my feeds. And if I click one of those feeds when I returned to the main screen, it will only show me the feet, the items from that feed if I click the button and it shows me a list of feeds. I also want to have an option in that list that says Show all feeds. And when I click that and I come back to this screen, it shows me everything from all of my feeds. Now that's fairly involved. Your going to first have to place a button on this screen. Then you're going to have to tie that button to an activity. So when you click it and activity fires up, that shows all of our feeds, and it will be similar to the settings activity. And then when I click one of these feeds instead of this coming up, it's actually going to say nothing and go back to the previous screen and show me only the items from the feed. I just clicked 40. Hard task - Check internet before getting feeds: and your final task. What happens if we have no incident? So I have switched off my wife, I hear, and I fired up the app on. There's nothing showing, and there's nothing that tells me is the user that I have no Internet or no connection. So I think it's the apse fault when clearly it isn't so. I want you to design something inside main activity, the checks, the Internet connection whilst it's kept trying to collect these feed items, and if there is no connection, it presents a toast or an overlay or something like that to our user and says there's no Internet connection, I'm going to try again in 10 seconds. Optionally. You can have a button on that little notification that lets the user press manually to try again. And I want your main activity to keep running through that try against cycle until an Internet connection is received. 41. What you have learnt and where to go next: So what have we learned? We've learned how to make an app look good. How to design it. Well, we've learned to steal ideas from the photography world. To achieve that goal, we've learned how to use Apple's APP design guidelines to build android apse, which sounds like blasphemy. But it works. We've learned how to design a user experience on a key to the user. Experience is having a natural flow to the app and also invoking emotions in your user emotions of happiness, because when their emotional about something, they won't uninstall it. Then we've looked at designing our user interface in Android Studio. We've seen how android studio separates the user interface part and the actual code, and it does a very good job of that. We've looked at how to create and navigate between activities and to make them Children off the main activity, and that allows us to have a back button. Then we've looked at a critical section, which is databases, and you are going to use this in every single project you do without doubt, you will need to use databases, so learn them Well, then we've looked it the next most common thing in Android and IOS development, and that's list views on their adapters to scrolling lists of things and the adapters that feed them the information that they want. Then we looked at our app permissions inside our android manifest, and we always declare them right near the top underneath the first manifest tag. And if you have something going wrong in your rap like nothing showing from the Internet, this is the first place to look usually. Then we looked at using libraries in Android on its not shown on this screen. But if I click project up here, external libraries, we can see we have support libraries and play services AP compact and we have some various other ones, and we've looked at how to add those. So here in lives, we have our simple RSS library. We also discovered that using another library can lead to errors that we can't necessarily fix. So always be careful of libraries, finally or not. Finally, actually, we have a way to go. We fetched our feet items from the Internet and we encountered that very first bug with our RSS to library. And then we learned some common ways to fix the up and debug it. Then we tweak the up a bit. We made our list a bit more beautiful. We took away the images which are a memory hog, and to replace them with a single bit of text which actually made it look quite good. If we just fire this up, of course it would choose now not to work. There we go and then I go back. Let's see if it brings up all of our feet. There we go. And so there's that pretty effect on the side and I think that looks really good. It's just the right amount of balance between the graphical elements in our app. Then we looked at creating a Web view in our app. Whenever we clicked on item, it would open up a Web browser and give us the story that we're after. After that, we discussed monetizing are up and the various ways we can do that on the way that we chose is by installing Google Admiral. Then I discussed testing and debugging on. If I wasn't clear, then I will be clear now. That will be half of your time as a developer, absolutely without doubt. If you don't test on, don't debug users will give you one star reviews on There's no point to putting the up out there than finally we looked it preparing our act for release and that involved creating an APP icon signing our app, which is important because you do not want to lose that key store, back it up, keep it safe because without it you cannot update your help. Then we looked at creating a Google developer account, and we set up a play store listing with all of the required graphics. I also discussed the device screenshots that serve as free marketing for your app. If people come across it and you tell them exactly what your APP does with that screenshot , they're going to download it if they need it. And then finally, I gave you some homework to do and showed you what the app will look like if you do your homework. Well, all that remains is for me to tell you go onto Google, have a look at the Android Developers site, go onto YouTube, have a look at various android tutorials because now you have a working app. You have a much better idea of what some of those guys on YouTube are actually talking about. It can be very confusing if you haven't completed a course like this that gives you a solid grounding. Also, Java is an object oriented language, and you should take a look at my other course. That explains object orientation. We've done some object oriented stuff in this course already, but I haven't particularly alluded to it. So I really recommend that other course to get a good grip on it. And it will come in handy in C sharp and objective. See on other languages that use object orientation. And all that remains is for me to say thank you very much for sitting through this course. I really hope it's been useful for you. In fact, it's been useful for me to go over concepts that have just become old hat for me, and I do every day now automatically. So I wish you the best of luck in your development career. And of course, if you have any questions, then please do ask them in discussions once again. Thank you for listening