Code 4 Apps in Android Studio! Build Your Own Video Player, Camera, Music, and Drawing Applications! | Jerry Banfield | Skillshare

Code 4 Apps in Android Studio! Build Your Own Video Player, Camera, Music, and Drawing Applications!

Jerry Banfield, Teaches 105 Skillshare Classes

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
24 Lessons (10h 17m)
    • 1. Ready to Code 4 Apps in Android Studio? Where to Begin?

      3:50
    • 2. CAMERA APP! Setting Up Permissions

      26:37
    • 3. Setting Up Camera Preview and Rotate Camera Feature

      27:44
    • 4. Connecting Camera to Layout and setting up the flash feature

      30:54
    • 5. Picture Callback and Take Photo Feature

      28:55
    • 6. Record Video Feature

      29:39
    • 7. Fix Bugs and Improve UI

      29:55
    • 8. VIDEO PLAYER! Setting Up Permissions and UI

      27:40
    • 9. Creating the Video Player ListView Adapter

      17:44
    • 10. Listing Video Files and Creating Video Controls

      37:25
    • 11. Creating the Video Player Activity

      28:47
    • 12. Finishing the Video Player Activity

      23:46
    • 13. Improving Video Controls and Saving Video State

      26:21
    • 14. Select Video and Rename Video Features

      28:00
    • 15. Share Video and Delete Video Features and Bug Fixes

      16:13
    • 16. MUSIC PLAYER! Setting Up Permissions

      31:10
    • 17. Writing the ListView adapter and adding music files

      32:50
    • 18. Playing Music And Adding The Seek Bar

      33:49
    • 19. Showing Play Back Progress and Writing Pause Feature

      39:58
    • 20. Fixing Thread Related Bugs

      5:44
    • 21. DRAWING APP! Creating UI and PaintView

      32:19
    • 22. Finishing the PaintView Class

      25:44
    • 23. Clear Drawing, Brush Size and Brush Color Features

      28:35
    • 24. Thank you for finishing the course! What next?

      3:05
12 students are watching this class

About This Class

Level up your career as a mobile app developer today by coding 4 applications in Android Studio including a video player, camera, music player, and drawing app!  This hands on practical experience helps you to program your own custom applications which can combine the features of the many different features you learn here!

Transcripts

1. Ready to Code 4 Apps in Android Studio? Where to Begin?: Are you ready to advance your skills? There's an android developer today. We've got four applications for you to code in here That will help you out a lot, which give you a clear focus. You can build a video player, a camera, apple music player and a drawing application. The idea is you code these specific APS. You've got something clear to show for it. And then you level up your ability to code custom applications to code for clients to build your own absent. Publish him and toe level up your career as an android developer, you might think Well, if you don't know how much a career is an android, developers worth take a look. This is on upward. These are how much android developers air currently earning working all over the world. Here you can see this is the skill as an android developer that is really in demand and that's why you want to learn it. Which is why I've produced this video course for you to learn it. If you're brand new to android development, I recommend you check out my master of Android development class first because this is intended to start you out as a total beginner. The course that we are in together here is a follow up to that course, and then the android studio emulator set up course. This is essentially the third course in the series here for you. We're we're assuming you're not a total beginner at this point, although if you already know a little bit or you don't know anything, you might just be able to follow along and learn that way. And this course were diving right in hands on where you code these four applications. We start off with the camera app. The camera APP has six video lectures that we go through, start you off from, have it from scratch and build you all the way through to fixing bugs. Then the next one. We've got a video player for you to code you go through and code the video player than we've got a music player for you to code. Then finally, we finish up with a drawing application. We do all of this toe help. You'll code all of these applications when you combine this with the skills you learn in the previous course In this series, the emulator set up Web view. Add mom mobile ads and calculator app coating. And when you follow up on the master of Android Development course, which is for starters, when you put all three of these skill share classes together, you have a powerful foundation to code almost any type of android app. These courses have more than 20 hours of video among all of them, and we're continuing to build more for you to help you have the best chance in your career . Is an android developer to get really good at developing on Android for the class Project on Skill Scher In this course, will you please share a link or a screenshot of the application that you code as a result of using this course, you can paste the screen shot of your code. You can paste the screen shot with a question. You can paste anything related to what you've coded as a result of being in this course that will help you to teach the course and allow you also to get connected with any of the other students and help us to give you feedback. We appreciate you enrolling in this course. I'm Jerry Banfield, the executive producer of this course. I've overseen the production off the And I found you an android developer that I imagine, based on my experience, watching his videos. You will love listening to his videos were producing new videos for you all the time. And I'm excited to turn you over to him now as we start the camera app coding section off this course. 2. CAMERA APP! Setting Up Permissions: Hello and welcome to these need, Andre. Development tutorial. This is part one of how to make a camera application for Andres. So we'll start by open or under this to the I d. E. And then we'll click on start a new hundreds to the O project. We will select empty activity. We will click on next. And as the name for these application, we will ride camera. Okay, We make sure the selected language is Java and the minimum AP I level will be 15. We can change that later, though. Okay, so we're gonna click on finish right now. We will wait for the I ve. To load the project so we can start working on our project. I will use an emulator to run the up so you can see what I'm doing and changes it takes when I code. So basically, we will be using the A B I want of camera as in at the first camera occurs because it is easier. He's last complex and gives you an overall idea and how camera works on Android. There's also camera too, but he's way more complicated, so we won't die a lot in that So now that the project is loaded, But we will do is it will change the beef old layout file with new one. Did it? That will open the rest folder here in the left side. They will go. We will go and open the layout folder and we will delete the activity main that xml to do that, we right click Anthes file and click on the elite. If we have these options checked, we will check them and then click. Ok, so now the file should be delete it do. We will actually create that file again. But we've be a friend structure to Did that label right click on layout full their goal to new lay out the reserves file. And you we will type his name at TV Tea main sort of the same name it waas previously Bottom root element. We will change the Kurd one with the linear layout we will Greek on. Okay. And now the i d. Has generated these new file for us. We will switched. We will speak to these file to text right here. And here is where we will code the u I over application. Okay, so in on droid. If we want to access hardware features like the camera, we need to ask for permission. So we're gonna open or manifest or 100 my Fez, but XML file and we will ride, uses permission and little type camera. Okay. After we DT's, we are telling the system that we will use the camera permission for our application. Okay, Right now we have to ask for permissions, actually, in code. Okay, So what we will do, He's We will, um, go to our main a DVD dot Java file, and we will start checking for permissions at the wrong time. Right. Okay. So what we will do? East, We will override the resumes. Mito for doubly gonna type at override protected Boyd on a resume. We will open the detailed and we will type super that on a resume which is basically calling The super meat sells off the class. Next we will. Jack, if the current version ease the same are greater than android marshmallow. To do that, we will do the following we type eve be old dot version capital with capital, so versions Oh, make sure your important field right here. Okay, Version and that is the K ain't okay. If these version is greater or equal, then Beeld that version codes that in. This is basically saying if the's version is greater or equal than marshmallow, why do we check that? Well, because marshmallow and later required ass to ask the user for permission. So Onley TV's If a statement is true, we will ask for permissions. Okay, So as you made things, we have to define the permissions that we will be asking for. Okay. So defined the permissions the android operating system requires us to We find a ray and the rate of strengths to do that we gonna created as a global barbell. So we will type private static final, um, string array. Okay. And we'll call it for missions. Let me read it to correct Lisa permissions. Okay? And we will set these, Of course. Remember to end line with a Sami Colin. And inside thes, we will specify the permissions we want to ask for in these cases, the camera permission. So just one to specify permission, we will do the following manifest that permission dot camera. Okay, we don't really end it with cynical, and I think let me see? No, we don't really need to end these with a semi called. So we have now Are permissions specified, as you can see, but we also have to specify a request. Permissions coat for that. We were going to say private static boots, Missy. Private static. Final request. Um oh, we've got This is a need type. So we're gonna say private static file ain't, um requests permissions. It will set these. Do you Basically any number. It can be three or 34. For example. Best really matters just a cold. And I don't defy your Okay. So after we've done this, what we will do ease, we will. We will check Onley if the permissions are the nine. Because, as you may know, the under Sumi tell these called Every time you're the user returns to the up So we want wants Teoh owns Be asked informations if we don't needed Teoh. So we have green a mito that we'll check if the permissions are denied and only then we will ask for permissions too Greedy Meteo writing following private bullion are apparitions denied. Okay, open the meet Held great. A for loop. Okay. In this case we have only one permission. So it's way easier. But we will write the meat. Told in a way we can extended later for more provisions. For example, we want to ride to the image to the D By starts so well will also need to storage permission future. So right now we will specify A and a global ain't barbell that well store the number of permissions To do that, we're going to say private static final end for missions count and these gays things we have, only Guanglie will set these 21 Okay, so we go back to our door, our our permissions united meet, and we have timidly descending colon. So right here we will create a for loop that will check if the permissions we want our deny there granted. Okay, it's gonna go and write four. The for loop for teens. I equals zero. I last. Then permission count. I lost loss hopes. There was a type of here. It's not blockage Manager, it's permission count. Okay, permissions count. Great. Now these will be be run as the for loop Every time we're checking for each permission and what we'll do every time we will be Keith. Yeah, Self permission. We will pass permissions permissions at I so, Index, I So if that jack self permission returned something that it's different than permission granted, we will have We will know that permission has being denied. Okay, So pocket your manager that permission. Granted, if it's a different and permission granted, we will return true, Which means permissions are the night. And if the for loop ends without returning, we will return False. Which will mean permissions aren't not the night As you may know, lt's we have a warning right here that says call requires a P I level 23 current meaning is 15. We don't really care about these because we will. We are calling these meat told Onley when a P a level is 23 above so we can click and these warning I can and you click on suppress at So Breslin's new FBI annotation in thes basically ignores the warning because we're calling it on lee when it's safe. Okay, so right here If permission, you've built that version that as decay in these greater or equal than feel their version colts that m so if he's more marshmallow or or greater and we will also check e permissions are denied. So we have two conditions here. And if both conditions are true, we will ask for permission. So we're going to say and our permission denied. So those both checks are true. We will ask for permissions looking. So how do we ask for permissions? Well, the same bullied on Li se requests permission. We will. Positive permission. We want to request groups permissions and the request permission code which we called request permissions. Okay. And after these we will return because we don't want to keep initializing the app if we don't cap permissions. So these request permissions will show the user a dialogue in which the system will ask the user for provisions on the user can either stop or hello permission or not. Okay, but the result of that dialogue is what we will handle right now. To do that, we're gonna write at Override, and then we're going to say public void on request for permission resolved, okay. And the barometers of thes we will be the following. The first want is seen as a means which contains a request cult servants. A request cold next one. He's actually the provision. So these parameters are past when these meetings This cult. So the first waas request, called the next one, is string this tree string array permissions. Okay, the next one years grand results, which are the results that will tell us you think the permission was granted are not so it isn't in our ray, which will be Cold Rand results. We opened the Mitos and we'll call the Super Mito too. Dad, we're going to say super that on request UN request permission resolved. So we have a typo right here in the Mito name on request Permission is permissions, so eat openness. And we call this super meat tote as follows on request permissions resolved and we will. Positive parameters we receive from the meat told Cole. So the 1st 1 will be request code. The same order, Of course. Next one will be permissions. And the next one will be, of course, grand results. Okay, great. Now, right. Hugh will check if the permissions where um accepted or not by the user. So did that. We first want to check the request Cold we send is the same that we're receiving here. They're going to say each request code equals two request permissions and we will also check if we don't have an empty results. So you can say if grand results that the length he's greater than zero. So if these two conditions air true, then way can go. Having check the permissions state Teoh do are making our lives a lot easier. We will call the Mito already created Is it that we're going to say if our permissions the nine these means the user has denied the permissions Otherwise the user has accepted them. So what? We will do the permissions already Night. So seems these is a camera application and the permission We're asking these camera if the user denies that permission when the APP is not useful at all So we have to Basically we cannot do anything If the we cannot go forward you the user doesn't accept the permission So we will close the AB and enable the app to keep asking for permissions. When the user opens Thea up again to do just that, we will do the following open to parentheses right here and in the in Iran will type a TV T monitor. Okay, then we go to the outer parenthesis. And you got to say, um, we'll open another one cause we're reducing these activity. Manager to cast the result off these that gets system service activity service. Okay. And after these three parenthesis, well, you write that clear application user data, which will, of course, clear the user data that you can see. And after we did out weekend Say recreate, which is basically exit the amber or something like that. Okay. And that's it. That's against you. We have a warning right here. Right. Which says call the requires NPL level 19. But again, these will be on Lee called a P I F A P level is 23 or above. So we're gonna ignore the warning weekly. Came in these Aiken and then on suppress leaned um p I annotation. As you can see, the warning he's silenced. And now that was a user denied. But if the user accepted the or a load the permission, we will call the UN resumed Mito. So the under Sumita will be called again. And this time the permissions will be actually allowed so we can continue with the initialization off our application. Okay, we cheese. Great. Now, in order for us to you know, if we have initializing previously, we will create a global barbell. So we're gonna type private bullion. He's east camera initialized. So is Cameron initialized. And these are the fall. He's had two false. So after these ive statement racket rate here will check ive camera initialize is falls. So if this camera initialize is false, we will initialize camera. Okay, great. So right now, I will run the app on my emulator so we can see that the permissions requests are working. Okay, While these is loading, I will talk beat about how the how the camera will work. Okay, so basically, the camera access is an A p. I, um, that he's made available by the 100 operating system, which enables us to access the camera object to open the camera, to close the comer, to take photos to change the molds of the camera and to request, um, features of the camera like filters, Um, exposures, um, out of fog cues in the case, the camera has over the phone queues and that sort of stuff Okay, so basically what we want to do here, he's Grady Comer object on Koth that will enable us to use the rial camera off already. Bice. Okay, great. So to do that, we have too great a camera object, right? It's a great e camera object we will use. I'm Jabba. And but we will also use the XML file in which we will display the camera preview. Do the user. So the user, of course, needs that to check if the camera is working a suspected. Okay, so what we will do now? We have a mirrored says era, launching a TV TV. So this tried again to check. It works. Hopefully we work now. Sometimes name later has box so it doesn't work it first time. But we have again on our another ever right here, which I'm not really sure why. Disease. Let me check. Let me check right here. So we go to error right here. It can maybe check what's going on with these with me Mighty my cities window hopes okay. And I will run the I began to check if I can get the actual error as either cures. We haven't error launching the activity. Okay, Okay. Okay. There's a lot of things that are not that clear right here. Okay, so let me check me. We did something wrong previously. So we cover manifest, which looks great, and the manatees do java also looks great. So let me run the up again to check you for everything. At least works. And we still have in the room of a lunch in the activity default activity not found. Maybe the activity name is wrong or something that Missy so breath deeply, Everything works. Lines should be fine. Let's see if the abyss at least installed on the emulator. Okay, lets see. Right here. Uh huh. So the app is not even being installed right now. So I think the problem is the emulator itself. So it's not. My error eased the error off the emulator. So the traitor fixed these. I will restart the emulator, so hopefully it will work now. So that was telling you. We want Jax. Is the the camera object from coat? Okay. So to access it, we will use the camera ap I level one. In this case, which, as I told you, he's way, way more simple and easy to use. Okay, Okay. The emulator is being restarted now and we will wait for it again. A beat to see if we can continue. Okay, so we can go where we wait for dot We will go tour, understood the project and we'll go to remain activity dot Jabba and we were on the on resume Me told as he my mind remember right here And we was checking if the camera one she wants initialized. So the camera object they was talking about can be access as follows. So going to say rabbits camera and we can call its live import Let's importantes camera hardware okay. And I will call these and camera and for safety. The reason I would say these two know sometimes the mother APC in may be using the camera so we can open it. So we declared too little. So that's the object We will use cell lever if I run the every now hopefully even work this time. Okay, lets see installed in a PK and launching Nativity. And as you can see, the camera application has launched right now so great it is working as we expect so off course. It was an error of the emulator. So that's the camera. We will use thes m camera object right here. Okay, which is great. So that's that's basically eat for these BDO in the mess one, we will actually initialize the camera and continue experimenting and learning how to set up the camera. I hope you enjoy it. And they see you in the next one by 3. Setting Up Camera Preview and Rotate Camera Feature: Hello and welcome to these new Andre Development tutorial. These is party of how to make a camera application for hundreds. In the previous tutorial, we initialize the permissions and we get some of you I and also solves problems we found along the way. Right now we will continue to neutralizer camera. For that, we will go to our remaining TBT that Java file on the on greasy Mito. You will go to the if he's camera initialize if that's false so we will go to that ex statement and we will get an initialize our camera. Okay, so basically our camera object, we will we'll use the following global variables. We already have the camera object, but we also need the preview off or camera for job. You gonna create the following? Um, private camera camera preview camera preview. Okay, let me see. Camera preview. Apparently we cannot create a camera preview. Let me see what's going on here. Okay, Camera breathe. You let me see. Let me see why we cannot create a camera preview at me, see what's going on. Something strange is happening right here. Actually, I think we have to implement the other Selves if I If I'm not wrong, maybe we have to create the preview ourselves because under it doesn't have a cannon beef. Old way of doing a camera. Previ. Apparently so we have to create that class ourself. Okay, so we will delete thes and created class ourselves. You'll did as follows After DeAndre Sumi tell, we're gonna create a new class private glass camera preview. So this is the camera preview. These will extend surface. You okay? We have to in forties, and well, and we'll implement the surface holder. Cow Colback. So implements surface holder, surface, surface holder. That's cold back. Okay, great. We opened these glass and that you may see week of these errors that who fix we will be fixed as we continue typing. Okay, So to improve performance. And these, we can make these glasses static, so we're gonna make static, and inside these were going to say, bribe it. Static surface. Halder and holder. Okay, which will be our surface holder. And we also create a local camera object. So privates stop T camera and camera. Okay, We geezer, camera, object. And of course, we have to create our constructor Mitos, which will be private because he's a in their class camera preview and its parameters will need the contexts which we will also called context and a camera we tweet also hopes Camera , what I'm doing here. Okay, camera And you also cold camera. Okay, we will open the constructor Mito called Super and we'll pass our context. Okay? And we will set em camera camera us. We get so in camera equals t camera camera. So here's a typo right here. Make sure it says camera. Okay, now it's fixed. Great! We continue and go and set em holder Teoh, get holder rate here and also m Holder add cold back to thes because we're implementing the goal back in the surface. Holder glass. Okay, Now also, we also have said that the type of it so we can say M holder that said type surface holder that service died. Push buffers. Okay, great. So this is for our constructor class right here. Now we are extending the surface view glass for dead. We have Teoh create a couple more details. The 1st 1 being public boy surface. Well, actually, yeah, surface created okay and move positive. And we have a perimeter surface holder. We'll call it Holder. Okay, open these meets out and said or global holder to these. They're going to say you will have to set a global glass holder. So remember when we were defining the the glasses out here on the camera and camera class, we also have to define the holder outside it. Okay, so let's do it right now. So basically these my holder thing right here we will. We will set that we will be the holder, that we will be accessed by our outside class. So cities in the study clouds were going to say private static, um, surface holder who call it my colder. Okay, so we have now created our holder and we can go back to work camera preview glass. So we go back to her camera, preview glass, and we will continue writing it. So in the surface created Mito, we gotta set. My holder will be said to Holder. Okay. And here we will. We will said the preview display of her camera. So we will you show the user the actual camera preview that we're going to say and the camera am camera that set preview display and Moon said these two colder. Okay. And we will also say M camera that start preview. Great. So as you can see here, we have to handle these exceptions. So we will quicken here and quicken surround Lee tried catch. Okay, great. As you make these look better, we will with these, uh bloody and inside he tried block right here and that See it for our surface created Mito . We will also have see creating surface destroying meat. So you gonna say partly boys served face destroyed. Okay. And again if you have surface holder of me holder And for now we will We won't be using these metals. Okay? We want to be used in de Mito Now we will go create another meeting with public boy surface changed and as parameters will be surface holder holder Then we will have eat Forman's we have eat, We've we can't just right doubly and entitled can just write in h And we again won't use these for now because we don't really need it. And now we have created our own camera preview glass We will We will use these class to show the camera content to the user. We just awesome. Okay, so right now we have done these and we will go and initialize or camera on. As as I told you, we will have toc find some some global variables right here. So after really find the colder, we will access the preview in this case, the preview we just created. So we're gonna say private static camera preview. It will said we'll call these MPRI beauty. Okay, great. But we will also want to create a kind of previous as a layout. So we want to displayed to the user. Right? So for daughter gun, Say you private frame layout and call these preview. Great. Okay, so right now we have a couple of marbles that they are quite useful for us and we will do the following. So in the honoree Sumitomo in these even statement of checks, if camera is not initialized, we will initialize it as follows. So we'll set em preview and preview will be sad to new camera preview these m and camera. Okay, great. And we also have to create a preview in XML the frame layout, which is he's right here. So to do that, we will go toward Activity Main XML file. And here we will do the following. They will do frame layout. Um, the wheat will be much parent. The height we'll be Let's see. We'll send it to sear of the B. But it was had Wait one for now. We can change these later. Of course, if we need Teoh. So we have frame layout, okay. And the i b of these will be camera. Um preview. Okay, which is awesome. Closed these elements and I think we're now ready to come t so go back to remaining TV, Doc Java file. And here after we initialize the m preview, we will initialize also the frame layout with our previous. So I'm gonna say preview will be set to find view by i d are that I d that camera review. Okay, which is great. And now we will add the preview off or called to the preview off or XML file. To do that will do preview. That's add view. And because m preview. So we have added our preview to the XML layout. Okay, which is great now, sometimes the camera in some devices won't work as easy as we might expect. So maybe the camera has some rotation internally that we have to take care of. Okay, so call me toes that we will call the meter will be rotate camera. So well, creating me to rake here saying private Boyd Broads, AIDS camera. Okay. And this is also useful when we're switching between front and back cameras. Okay. It's the first of all in these rotate camera. We have to check if the camera object is not know her daughter gonna say Eve am camera is the friend than No. So if income in a care camera is the friend than though, we will gather the rotation of it. The rotation of the camera. Easy, useful parameter. We will later. So we will set that as a global barbell. So private, I mean rotation. Okay. And the rotation off the camera, we'll be a value that will contain be kind of the irritation off camera. OK, so we'll just call it rotation. Okay? It's for performance. We can also use a static here so static, which will be get better. Not really important, but, you know, kind of better. Okay, so we have right rotate camera. If camera is different than rule that we will get kind of the rotation off display. So you gonna say rotation will be equal? Teoh Thes that. Get window, get window monitor that Get the fold display that gets rotation. Yeah, get rotation. Great. Now we'll do some checks right here that we have. Teoh No, you re our second irritation, right or not. So first going to say ive rotation equals zero. They will change rotations in 90. Why? Because that's kind of 92. The fold. So we have to change in everything. Function of 90 Okay? And then we're going to say ive else ive rotation equals one. These will be set Teoh rotation. Um, zero. Actually, I'm not wrong. Yeah, so gonna say so. We have to Euro one. Tell us. Go with two So you can go. I'm take log way. So else if rotation equals equals two. Okay, well set rotation Teoh T hander than 70. So we Jeez, through 16 mines 90 90 90 a gay and else it's three. It will be 100 nadie rotation equals to 180. So these basically enabled sauce to know about the rotation off e d. Buys. And also the rotation of the camera itself. Okay, so now we gonna kind of cavity flag that will tell us which camera is being used. Okay. Okay, So that's going to say as global barbell private stop. Take fully in Nicholas Leach camera, for example. And one said this it through because we will use it as in a simpler way to set and get the camera. Um, which camera? Hey, seen used, actually. Okay, so after Dees of three D bees, we want Teoh to set the new rotation. So you can say I am camera that set these play orientation that will set these two road station. Okay, which is awesome. Great. Now additional to that. If which camera these false. What that means. Okay, So what means when which camera is falls? Well, it basically means it's not the beef old camera. So it's not the back camera. Easy front camera. And when we switch between front and back, sometimes we have incompatibilities. So it's all these incompatibilities. We change the the rotation. So we check if rotation is equal to 90 people said the rotation Teoh 270. Okay. And C l's else ive rotation is equal. Thio Thio 170. Okay, we will said rotation equals 2 90 90. Okay, great. So that's with each camera. And then we're going to say the parameters off the camera until the barometers off the camera are basically the features on the current state of the camera, which we will be access them as a global barbell. For that, we go and say private static camera that barometers Coben p okay and really find that is a global barbell. So now if we go back to rotate, meet told rotate camera Mito, you're gonna say, P, you're the parameters equal T m camera that get barometers. Why do we do this? Because we can change Change the prompter. So we are getting the new ones they're gonna say, be that set rotation And it will said these two rotation okay, and does a M camera that's set barometers, of course to be. And that seat for rotate camera Mito for D rotate camera meet held. Okay, so we go back to our country Sumitomo in where were were initializing the camera we have out of the preview. As you can see right here. And just now we have to call rotate camera because that means that we take care about the current estate off the camera and fix it for us. Okay, which is great. Now, some cameras have flash features, and some actually don't. So to support them, we will go and creed a button on our activity Made an XML file. So after d frame Leo gonna create a leaner lay on wheat. Much borrowing the kite will be feet DDP, for example. Three orientation will be set horizontal. And here we will start creating kind of bottoms. So the first bottom, the little creates right here will be about the flash features. Right? Okay, so the flash feature will be as follows. The wheat will be zero the B. The height will be much parent. The wave will be worn. Okay. The ivy of these bottom will be flash just like that. Okay, So we will also create a couple of more elements rate Hubert. We'll do that later. Okay? So if we go back to work, main activity that Java, as it is as I was telling you, some cameras has half flash and some cameras 1000 Cath Flash. So we have We want to check even the current camera. Pass or not, Flash. To do that, we will create a mito. We're gonna say private static bullion. Haas, flush. Okay, Okay. And we will actually get the parameters off camera. We can get some parameters of her camera calling them, um, gets aborted color effects, for example. So some parameters, some cooler effects could be black. And why? There's something that to store those color In fact, we will create in the rail east as follows. Private static, least of strings. Call it. Oh, don't forget to import the least least off strings. You will call it cam defects. Okay, great. So inside he has flash me. Told we will take camp effects will be too. Be that get supported caller effects. Okay, then we gotta basically, when we checked for flash will also be checking for these cam facts as a way of loading them quicker. Okay, They're going to say and get the flash melts, deceived by support to flash or not. So final least off stream Call this flash modes and said P that gets worded. Flash moat. Okay. And here we would say the first check will be flash molds. He's no. Then we will return Fault. Right away, sir. Returned False. Which means thousands sport camera. Okay, but then it's still not ends 1000 in here. So we're going to continue for string. Collage mold. Okay. At collage molds these the for each loop. So gonna say eve camera that parameters. That flash mode on that equals flash mold. We will return through. Okay. Otherwise, outside before each met Mito Legal, we will return False. Okay, this is great. Now we know if the camera casts or not flash features. Okay, This has seen everything for these video. We will continue initializing these complex camera application in the max through. I hope you like it and they see you in the next one by 4. Connecting Camera to Layout and setting up the flash feature: Hello and welcome to these new under development tutorial. This is part three of how to make a camera application for 100. And these two tour will continue to set out for application and, like, the flash features and so on. So now I'm seeing there, Right here. So the rotation I forgot ended with a semi, Colin. So now it's fixed a Barnsley. They have another girl, the same air right here. Another Sammy Colin and the thing We're good now. Okay, so we were setting up the flash features, if you remember. So we were we ready to rotate camera, and now we set out thes cast flash meet tothe so that meat told will naval loss to know if the D buys camera fast or note a flush. Okay, which is great. Okay, So what we will do you? No. Is that we will hike the flash bottom we created previously. If the devise has no flush, we will do that on your resume. Me told in the bracket in which we initialize the application. So after rotate camera, we will Grady flash bottom. But we will also want t access thes button from outside the's on recently. Tell something Creating global bar glory here. Type private. Um Baden Flash hopes A casting for the body. Okay, Baden, uh, slosh the lives Baden flash be made me Okay, so we have a bottle right there and here I will initialize that bottom so unsafe slash b will be equal to find view by i d r That I be got flash. So we have set up that previously. Okay. And now I will check if the device has flaws. Your nuts. For that, I will say it fast, flash. I will go and say flash be that set BCE ability Teoh to be feasible. Okay. Any you feed the 1000 Lodge, I would say flash be that said feasibility to go on. Okay, which is great. Now we want to know when the d buys orientation changes. Okay, so we want to know when the bis orientation changes, Maybe the user rotate the Dubai. So we want Teoh irritate the camera or D um, our layout there someone. So to do that, we will create a rotation listener, okay. And rotational leasing. Very family wrong. So, or inundation Least there. Or rotation Listener. Let me see Let me see. Okay, Uh, orientation event leasing. They're actually OK. So go created as a global barbell right here. So you're gonna say bribe goods, static orientation event lease in there. We will call its orientation lease in there. And for security reasons, we will initialize it. LOL. Okay, so now we have created our orientation. Lisa There. So we have to initialize it just after he's lying right here. To do that, we're going to say orientation Lease in there. Rendition the vandal East in there. You gonna said these two you orientation event lease in there. We'll have to pass a contacts right here. Go fast. He's okay. And it's have Don't forget to end with a semi colon. And inside the orientation changed me. Totally gonna say rotate camera. Okay, so now we know when the camera has bean rotated. Right? So that's great. But what? We also in order for destroy work, we have to go to War 100 manifest file. And inside here, let me spread disease warning. Okay. Inside here we will go to our activity and off some new features. For example, we gotta say comfy changes and well said t orientation and also screen size. Okay, so we can know where in the orientation changes, right? Okay, great. So now we can go back to work, main and TV about Java and continued to set up our application. So we have the orientation event leasing arranged here enough to deeds. What we will do, we will enable it. So to do that, we're going to say orientation in Banda Leasing there. That's enabled. Okay, Great. No, Maybe we want to change to access something like the fuck use mode, you know, off the off for the application. So we want to be able for the opt to change between continues for cues, mold and non continues focus mold or even if you cast funky smell, right. Okay. So to do that, we will create a global horrible. We will call it private static f m which will ever present a bully and sorry. Very pathetic bully in f m. Which is or were Fuck ease mode, right? So yeah, that's it. Private Boolean f m. And we will access it, um, to know our current fuck use most. Okay, so we want to change the focus mode when we long click on the preview elements, actually, on the preview lay out after re enable our orientation event police in there. What we will do is the following gonna say preview a review that said on long click Lease in there and inside these view on long, bleak lease in there and inside here, we have to know if the fuck is mold is available or not. So most devices, if not all only have has focused more on the back camera. So you gonna say eve bleach camera clips. So, Eve, which camera? Okay, so you're going to say inside these ive folk use mode, so f em f Emmys enabled. And else if it's not OK, So if f m. You got to say be that said Faughey's mode, who said camera that parameters that Faughey's and moaned out toe. Okay. And we've not know, actually, actually, we want did this. So right here. Fuck. You smelled east through. We're going to say camera parameters. Um fuck. Use mouth continues feature. Okay. And if it's not enabled, we will say p that set folk used both camera barometers. Um, fuck his mouth out toe. It's not flash mode out. So It's Falk. You smell sorry. It's of far cues both out toe. Ok, great. And now we will try to set be parameters off our camera. Okay? Going to say dry block and open to try block and say, am camera that said barometers able Casspi as our parameters and going to have to catch an exception. So we're gonna catch Andi exception. Uh, we don't really want to do anything with these exception for now, so just let's just leave it there. And of course, we have to change the focus, Mel. So f mm will be two different off. This means if you through making falls and defeats falls, make through. So when long, clean grade here, we will actually return through here. Okay, great. Okay, so we have set up. This is basically everything we need to set up for a kind of camera right now. Okay, we have done rotate camera. We have don't has flash me told we have created the review, but you also have to create some new interaction features so the user can interact with the camera. So after these previewed glass, we will create some interaction features. Um, yeah, we can do it as a global click. Least in there, maybe or not. So let's let's now try to wrong the camera, actually, to check if you eaten works, right? So I will be running it now to check if it compiles at least. And if it works, so it's great. Will be running, scanning files, installing a PK and longini DVT. Let's see what happened. Maybe there was a neighbor or something like that. As you can see, we cabin there were it says, attempt to invoke virtual Mitos get spiritually effects on the little object reference. Okay, so these means that parameters have non bean initialized yet, So we haven't initialized the parameters, so let me see. How can we initialize are parameters? Okay. Okay. Okay. We have to rid eight in the camera and kind of initializing parameters when we call rotate camera And the error he's in lying in which I was thier sorry for God's 1 31 in 94. Okay, Okay, okay. So, as a quick Fikse, we will come in, please line and run it again if it works. Okay, lets see. Well, maybe it's not the parameters that it's no maybes. The camera itself that it's all so we get the same result. But we shouldn't be getting the same results. Right? So camera keeps still Piece to be. Okay, Let's see. Okay, Okay. Okay. So here we're not initializing the camera correctly. We're not opening the camera as we have to open the camera. So actually, the error was not in that line of coal, so we can uncommon to these. Okay, so we will uncommon these and we will know initialize the camera. The thing with the camera is that we have Teoh access it when the application is resumed and we have Teoh free it when the application is, um cost. Okay. Okay. Okay. Okay. So when the application is resumed, we have to initialize our camera. Yes. Uh, okay. So for D for that purpose before the m preview, we will now say m camera equals two camera that open. Okay, it will Rondi up again and checking out the words. So we're running now. The app and checking even works. And as you can see, it is actually working. We can see the camera. And these picture is not a really big Juries. Theo emulator picture. Okay, so we can move around right here. As you can see, there's dog parade. There's everything is in the emulator for as developers to test our camera. And as you can see, it looks great. So all the cold week used has worked. Okay, which is awesome, of course. But now we want to hide these camera bar and also these That is far. So did that. We're going to go back to work under the studio project. Okay. You see? Okay, so go back toe. Under this duty a project, we will open the valleys folder here at left, then just eyes that XML file, and he will create a couple more items. So the first side and we will create movie window, no title and set these true okay. And the next item we will create will be window full screen. And you will also send these two through. You've around the up again. We can check if the bars are no hidden. So we're compiling the application and it will be running soon. So now it's installing and running. And as you can see No, I have these whole camera view which shows more screen real estate as you can see, which is of course, great. Okay, so we go back toward under this to the abroad, check to see the next stuff we have todo Okay, we will go and and think a bit about this. So when we open our application, we have Teoh get the camera. And when we when the replication is paused this means the user switched to a number application. We have to release the camera, right? So that's a mosque. Otherwise we're not doing it correctly. So to release the camera, we'll have Teoh override the on Pause Mitos and release the camera and Teoh, resume the camera. We will have Teoh um get in or under assumed Mito. So we're gonna go to remain a DVD. That job of file, Okay? And we will Okay, let me see May Nativity Dog Java and it will create a new meat tothe. So after the own resume meet Self Curie will create the Mito that we'll release the camera . So you got to say private boy re Elise camera Okay, great! And inside these mito who first do eve and camera is the friend then? No So I m camera is different than long. What we will do is the following. We're going to say freed view that remove, remove, um, remove view. I am preview. So we removed the previous and we also say am camera that release that we're releasing the camera free to be used Another app who also disable our orientation. Least there's gonna say orientation Lisa there disabled and you will set em camera to know right here. And it will change which camera to the default one. So I'm going to say which camera which camera actually is. He's way. Okay, so we will use thes Mito later when we override our on a boss meets out actually. Okay, great. But now we also okay, let me see when we do or on pause, meet tothe How can we release our camera? So basically, what we have to do is write the on pas Mito do and say override for attack too. Boy on pause pauses. You can see and go say super dot um pause and right here. What we will do will be cold release camera. So we have our camera released Weegee's of course. Awesome. So when we don't user camera anymore, we can just release it. Okay. Okay. Okay. Which is awesome. Okay, Okay. But what? We have todo right now, ese, if we have, if we don't. So if we go to our under assuming tell right here. Right, So right here we will have to to check everything works fine. So let's Runde the up for No, that drone, the app and Jackie everything works fine. So the ups he's now running right here and see you may be able to see the pain is the dog. And as you see, we have a kind of something here in these line cover white line right here. These white bar right here, which really can't be access because of thes Bari cabaret here. Okay, Weegee's used for the developer mode. Okay, so let's see if I can move thes of beat. Let me see. Okay. Let me see if I can move these. So there we can see that there's empty these bar. He's just empty. Why? Easy, Empty? Well, because the emulator 1000 half flash, But if your phone has flashed in, the flat bottom will appear right there. Okay, so we will have to add more features and make sure the upwards correctly. Okay, for now, we will Faulk use on having more features. Okay, so let's see. Add more features will go to our TV team main that XML file. And right here we will have more bottoms apart from the flash Boston. So we're going to go and of the switch camera. Barton. Okay, You got to say button layout weaved will be zero the B layout height will be much foreign. Weight will be one. And the idea of thes bottom will be screech camera. Okay, so we have added the sweet camera button, so we have to also have the switch camera. Um, camera feature two out of the switch camera feature. What we have to do is the following We will go to our main activity. Thought Joppa. And after we have breadth E flash box maybe doesn't really matter exactly where you put this, but you can do the following. We're gonna say final Barton and we will call it screech camera. Baden. Okay, well, said Thies defined view by I d r Did I heeded so each camera Okay, you're gonna said Listen, there was say in speech comer bottom that set Unclean lease in there New unclean lease in there and inside these What we have to do First of all, he's the following. We want to call and camera that release. Have to release it first. Then you got called sweet camera And to switch the camera we have to create. Actually, Amy tells to make thes luke better. Okay, so let me see the mito we have to create. Okay, Okay, okay. Okay. Great. So degree the switch camera Mito won't go outside the laundry Sumitomo right here. Gonna die. Pry. But boy bridge, come right. Okay, inside these meat. So we're going to say ive which camera? Ailes. So if he which come or I'm going to say m camera equals, um camera that open. Okay? And this problem is going to say, um camera, that camera info, that camera camera camera facing from so coverage, it's a dog years camera phrasing front, Okay. And otherwise, going to say just m camera equals camera that open. Okay, so this is our reach camera. And of course, we have to change the which camera flags even say which camera equals Teoh. Not which camera. Okay, so when we switch camera busy is what we actually half to dio. Okay, so let me see what we have to continue. So we worked on the on this switch camera meet told. Right. So we have to go again there. Um let me see. Right here. So we're gonna is here than the sweet camera bottom, actually. So in these bottom, what we will do he's the following. So we first released that camera. Then we call sweet camera, and then we call rotate calmer. And after these, we will do the following. Well, say try open the try block and say, And the camera that said preview these play, we will be said to my holder. Okay, we will catch the exception by saying exception e or something. You don't really need these for now. Okay, enough through the's, we're gonna say M camera that start preview and you're gonna say if has flushed. So we've it has flattery will show the flash. Maybe he has a front camera Flasher, but camera flush. And if it doesn't cast flush, we will kind. So even has flash. We're going to say flash Barton. That said BC ability to be simple and otherwise gonna set it flush button That said, BC ability to go on. Okay, so that's great, too. Okay, great. So we now? I don't know. Then later spurts from camera. We will know now, right? So let's run the up and check if these works, It's now I'm compiling the said the need to the emulator running the up. As you can see even press the button. The camera is switched to the front camera, which is also in emulated one. If I press it again, it is switch back to the back camera. Of course we forgot He said the attacks of these bottom side said Now it should say sweet camera or something like that. Okay, so let me see. We got it. We're going to go to the main activity made that xml And here in the switch camera bottom. Go and say texts, speech com or a sweet camera. And we also forgot to do that in the flash. So we're going to say button on the flash one has a text flash. Oops. Oops. Oops. Let me see. Okay, So, flash Okay. If I run the app now, let's check your feet. Works so Ronnie. And as you concede, has this sweet camera Bob right here. Okay. If I press which camera, I have it right here. If a prison again, you have the other camera. Okay, great. So that was seized it for these BDO. I hope you enjoy it. And I see you in the next one by 5. Picture Callback and Take Photo Feature: Hello and welcome to these new Andre Development tutorial, Deasy's Bart for unhealed to make a camera application for 100. The previous videos we learned How can we aren't the flash feature and the sweet camera feature in these bigger We will keep learning more to improve or application and make it born feature reach. Okay, so we steal are not able to take photos. Right. So we have to create a bottom that will take photos. So gonna create a bottom in the middle of these two right here. And it called Baden Wheat will be zero bp. Okay, um, height. We will be much parent. The weight will be one. The ivy will be Take a photo, for example. Take photo and the next will be take photo. Okay. I was awesome. So now to implement these in cold, we'll go to our main activity, the Java, and we have to be able to take a picture with that bottom. Okay, softer. The switch camera Baltin we created here. We're gonna say final Barton and we're going to see Take photo Barton. We will be said Teoh, find feeling I'd be the Arditti need to take photo. You're gonna go and said the least in there, Every saying Take photo Barton about set on leak lease, inner new unclean lease inner. And inside these click listener, we will do the following will open open a dry block and inside that they're going to say, And the camera that take feature Well, pas No. Okay. No. And thus em. Beecher So m picture. He's a He's a object that we happened created yet, So we have to create it now. Okay, we cheese the camera picture Colback after the on recently tell, it'll do just that. We're going to say private camera that feature called back. We'll call it m feature because that's the name we use the ball and pictured new camera dance picture call back que camera that secure cold back. What's going on here? So the guys say new. So it's not a mitos against Adjust camera that pictured call back Now let's Previ called brackets. Picture called back. New picture called Bacal opened these element right here. Okay. And with that semi colon and inside these what we will do easy following so we will override the UN pictured taking me tells you gonna say public void Beecher Day can. And inside these ago, say, bite array data is a feature data going to say camera camera. Okay, so you have over right over written these meat tothe So when the teacher is taken, these meat of lubie called. So we have to save the picture to the file storage for that is going to say file out food stream. Call it F o s for something too important to so f. O s. And it will set these to you file out with stream and we cuffed. Teoh creates some sort of file here. Right? Okay, So we're gonna create a meat tothe that will be about creating a saving a file to be safe. Right? Okay, so outside thes tell the right here. We gonna say you'll create a £5 actually, that will start the current date. So the name of the picture will be the date you're gonna say Private stop teak string save file. We will pass a we'll pass it a file path. So stream filed. And inside these meets a little do the following file f will be equal. Teoh, don't forget import thes file ever will be equal. Teoh new file. We defiled that barometer. Okay, They're gonna say Eve if Bizarri f that exists, actually, if it does, Maxie, So negation of negation FX absorbs Oops. Oops, if indication FXC So if f doesn't exist, it will create the directory. So going to say I have that make the year. So the path is a directory after make beer, okay? And we will return the file path. So you're going to say return? Um, f glass, um forward slash glass new seem full. They four meant will bus like the format of the date. So be mm. For months. Uppercase m m now lower case d D for day. Upper case H A for our lower case, M m for minutes and lower. Case s s for seconds. Okay. And going to say that four meant on a visit calendar that get instance. Dodds, get time. Okay, so in this way, we get time. We will return. Basically this. Okay. If we go back to work feature called back. So our M feature meet told. We kept to said, um, the previously filed out of the stream do the following. So we're gonna set these Teoh save file, which will return the path. And when we pass, it will be string down value off, and we're going to say M environment don't get external storage. Public directory. So let me put these in the line for better be civilization purposes. So environment that get externals public directory, okay. And basically, what we have to pass inside these these environment environment that directory features. So he will save our followed out to features directory. And after these three right here, we're going to saving this J Beck files again. Say, Dodd, J P. G. Okay, we can end the line. So that is the file out the stream. So to write a data, actually, what we have to do e se um, if o s that right, they, uh okay. And you have to close that certain say f o s that close, so it thes may produce an exception. So we have to surround it. Really dry catch. Block's gonna say before these try will open it and put all these lines inside the try block. Okay? And we will then close it with the catch, um, exception be or something. Okay. And you were ready to go the case. So this is the picture. Cold back, right? Awesome. Now we have to go back to our take picture thing right here. Let me see where we were previously. So we go back to her, take photo bottom, and we go and say, Am camera that take feature? No, no, I m. Beecher. On the next line we will do is M camera that start preview. In order to re seem restart the preview. Weegee's again awesome. And we also have to end the dry with a catch. So Koch exception E Okay. And now we have the day photo feature ready to be used. So let's Ron the AP. No. And fast if feature works or not. So let me see. We're installing the A p. K. And as you can see, let me move these thing. Okay, so we have our take photo and switch camera right away. We have to, but in this space here, between these, it quickly can take photo. You can see the photo is taken, but we're not yet able to browse it. So if we use another up to browse the photo, maybe we can I see it So let me see if they have any. Because Galleria, let's see if these words okay, now, this is not what we want. Maybe another files application right here. So if I opened the files application, Okay, what's going on here? So let me see every open the files application, and I go Teoh, um, here and show internal storage. I go Teoh under 80 k and I go Teoh pictures. I have no items right here. So why is that? Well, it's actually easy. The reason of that is that we don't have be permissions to rights the file. Okay, Teoh, get those permissions. We will do the following, so we have to declare them on the manifest as the first step. So after we declared the camera permission, we will declare these storages permissions that can say uses permission, right? External storage. Okay. And also uses permission, read external storage. Okay. And after we've done this, we will go back to work, um, to remain a tv t dot java. And remember, on the first tutorial, we set up the permissions and I told you that we will be needing more permissions, so we'll go to her permissions array here in this visit Final the other permission. So the 1st 1 the second next one being manifest That permission that right external storage on the next manifest that permission that read external storage. Now we have these permissions. We have to change permissions. Count to three because we now have three. And now we will run the app again to check if these works. Or maybe we have to do something additional to these so that c as you can see, it says alot comrade to access folders, media and 1000 or device and say hello. Okay. And the guy press take photo right there. And if I go to our file monitor, maybe now we can see that the photo exists right here and the photo waas taking successfully by our application. So right now you can take actual photos with these application we just made. We can switch the camera, okay? And we can take photos and keep doing these for as long as we want. Which is, of course, awesome. So let's check the co The beat to deceive everything is working as we expect off course. Let's do some testing because the up can actually have lots of box right now. So let's run the up again on the emulator right here and we will press on the so let me see what's going on. So we will press on the com Baden to resume to close the up, and I will open the up again and still works. Surprisingly Okay, So it's steel works quite well. Let's go toward code and check for some inconsistencies or something like that. Okay, lets see. So right here we have that thes field requires eight B I level 16 and the current Ronnie's 15. So you're gonna change that too? So we go to great Elice Crete's build that greater module up and will change it from 15 to 16. A Newell seeing now. Okay, so every time we modify these file, we have to seeing it. Now, if you don't find these bottom, you can find these elephant bottom up here in click on it. So we wait for to sink to be completed and we know can close this and these should be gone . So now he's warning he's gone. Okay, so we have request permissions or permissions deny the request, permissions all of these so East camera initialized. So as you can see, we are initialized in the camera every time we go on our own recent meeting, which is kind of that we can improve these beats later. So we're not using these flak because we're in a changing it and indeed, anything. If we were changing it, we have Teoh initialize it again. So let me show what want to say so if here he said, East Comer initialized through okay and I robbed the up again. Let's see what happens. So on the first run, I don't think we will notice any change. So let's let's waited for the compilation to finish So but remember that when the on Pause Mito these called We are releasing the camera in order to enable other ops to use it. Okay, So wearing stolen the up right now. And as you can see, the camera steelworks, but only because on create was called. So now I want to use trade where they want to say so. If I pressed the home Bob okay and I opened the camera again right here, then nothing is shown. So it's not working because the camera, the flak. Well said to fault. So how can we fix this? Okay, what sets it true, actually. So how can we fix this? Okay, so every time. So if the camera is not initialized, we have to initialize it right here. Bob's. We have some cold right here. That can be that we can avoid to call again. Okay, So the simple solution is just don't use these at all, but that won't be very, um, very efficient. So we will figure out ways to make these more a vision in the next tutorial. So let's continue with these, Then we have the picture callback rate here, a case of file SE files Which camera on bars release camera, which works. Great. Now, the camera effects are not yet implemented, but we will implement them in later tutorials. Okay, so we're now just checking these. That works fine. If we go, we have to Else check something else. The rotation of the device. So let's go. Let's go and run it. So, Leslie, the quick Fikse off thes that we will comment thes is camera initialize through? We will come in this so we won't have that problem. That is the quick, not very efficient fix with its peaks nevertheless. So we're going to say I'm going to go to the camera right here, and we will rotate the device. And when we rotated, as you can see, the camera also rotated, even though the these guys don't rotate because it's better that they keep in that way. So even if we rotate thes way in the other side, we can steal the upside down. You can still use the application, right? So as you can see Edward spread self here, we have tested that the obvious kind of working great. If we switch the camera, it's switching. If we switch Barket switching bark, it would take photo it's taking. So I will put in this space here between taking photo close did right now so that minor fixes that important. Teoh. Okay, what's going on here? Okay, go to do with two main and take photo in this phase right there. I'll run the up again right now to check feed words. Okay, Now take photo. How's the desired look? Okay, now, when we want to change thes, um kind of facts was saying called every factor that kind of stuff we will see. How can we fix them? Okay, so when we check effects, so become camera effects have to be initialized, as we did actually on when we called it on the house lodge. Exactly. Were actually here. As you can see, your initializing it. But then how can we use them? Okay, so how can we use these effects? Okay, so we will implement thes actually still Turyk asylum things very complicated, actually. Easy to do. Okay. To implement these, we have to maybe create another bottom. So we're gonna goto activity main And maybe before you take photo about I'm going to say Barton, we see road, the B height, much parents weighed one. The i V will be effects and the text will also be effect. So we have created being XML now will go and create job. So it's do that. We're going to go to war on resume Mitos. And here maybe just before you take photo. But we're gonna say final bob effects. Um said he's defined view by I d r Did I d effects and gonna say effects Barton that set on Greek lease learning new unclean lease in there. And how can we change the effect? So we have on the ray that because the effects drunk. Okay, so we will have tea kind of store and effect index. So going to create a global variable right here, which will be private, in fact, indexes, you can see court could be set to see road. Not really this survey even. Okay. Okay, So we have effect, index. If we go back to war effects Button, what do you want to do? Is first we gonna say e That said colored effect. You said come effects that get the effect of effect index. Okay. I'm gonna say aim camera that said parameters p. And after these, we will increase the effect index second, say fact index plus plus. And to avoid an index out of bounds, exceptional did following. If, in fact, index, he's, um, is equal. Maybe to come. Fact that size which race agree? We're out of bounds here and say effect index will reset that two zeros, that kind of thing. A wheel will be reset with it reached the end, and they've goes back to the star. And and so what? So now we've got around the abdon check. If our facts actually work are not, hopefully day with Okay. Now, using stalling the a p k, I'm switching to the emulator. That's change where the camera is pointing to kind of see an effect. And if I press in effect, do you know what is in the change and real abilities, Maybe to be curls the emulator, right? Maybe it's because the emulator that we don't have effects here, So let's see if we hear storing the effects right on the, um, kind of far on the house flash feature. So, in cold house flash, right here we're story and get spread color effects. Okay, which can Okay. Okay. So what do you come to do? Here is, if we quicken effects, it doesn't happen. Anything, at least in my eyes, maybe depends on the device. Maybe these Emily 80,000 half that feature device. Which camera? Maybe here we can have some fence. Not really. So it's not working for these Dubai's, but in some devices, in with work and others it want. So in order for us, Teoh, improve these functionality. What we will dio is we will sat when So we're gonna go in into the flash thing. So house flies right here. We're in. We're all right here. We gonna say Eve. So first of all, and missing if come effects that size equals zero. We have to hide it, but we won't do it from here. We will do it from the arm re Sumi tothe. So let me see. Right here. Um maybe right here. I'm gonna say it. You the facts. If come effects that size equals zero, we will go and say, Well, actually asked, 30 of argument should be these. So after these thing, we're gonna do this. We're going to say effects button that set BCE ability and gone. Okay, so we've got a Ron the up again. See what happens. Some running the up checking right now. You can see we still have the facts, Walton, but the effects are not being produced. Well, these is an issue off the emulator in a real device. Thes won't happen. So that's it for these BDO. I hope you enjoyed it. And I see you in the next video by 6. Record Video Feature: Hello and welcome to these new Andre Development tutorial. These is part five of how to make a camera application for hundreds. In previous tutorials, we set out permissions the you I Some features like taking photos and checking for a flush and all of that in these video, we will continue fixing our code, making it more efficient and also adding more functionality to it. If we run the out right now, we can check the current estate that we left in the previous tutorial. So let's run to make sure everything is working fine. Okay, So the ups now, Ronnie, right here on the emulator, as you can see, and we can move the camera around and we have three bottoms right here. Let me see if I can find this. So you have three bottoms effects. Take photo and switch camera. Okay, So the effect one didn't worked on the emulator and take photo. One actually worked, and the switch camera also worked. Okay, As you can see, it is working. Okay, great. So we know. Well, maybe check when we rotate the device. How it looks like, so we rotate. We can see the rotation off the camera right here. You've irritated again. We can see these again. Okay, so let's do a couple of changes in their i e right here. We're gonna go, and we're going to go to our 100. Manifest that XML and the orientation we will set off the activity will be or inundation. Um, full user. Okay. And then we'll run the app again to check how it behaves with these new setting right here . So we're in stolen if we're running it now. And they were on in Greece, which the's we can kind of observe what's going on with these orientations. Okay. The problem with these is that maybe we have to get and all variety, uncle figuring configuration changed. Mitos. However, we already have a configuration rotation listener. But let's see if these makes thes living better. Maybe. Okay, we're gonna go and write override, um, public void. UN configuration changed. Okay. And the barometer will be gone figuration and see, for example. Okay. And then forget Teoh import the configuration library right here. Okay. And said he was gonna say super super that un configuration on. So here's a typo. Gun figuration changed on the configuration changed and we will bows, see Object. Okay. And here what we will do when we get this, we will rotate the camera. Okay, That run again to see if it gives working. Maybe in some devices, these won't work. And some others well, maybe work. So that's let's figure out what's going in. Okay, so here we cover or application. And now let's show these bar and less. Let's rotate the phone and it's been rotated. Kids rotate again. It's still rotated. So for some devices will be kind of a fix for others. It would be kind of Samos previously. Okay, so that's that's good. Now we were continued to do more more working application. Right now it's able to take pictures and total flash and those basic features. Okay, but maybe we also want Teoh record BDO right? So we will go Teoh Activity Main and create a new button right here. Maybe after it we take photo spot to open an element and type Barton. Then you're gonna say weaved. Zero vb hide too much parent and weighed 21 Okay. The idea of thes bottom will be, um I be will be record, um video okay. And the next of these will be Rick. Okay, now let's run the AFP deceive the bottom looks. OK, so now we're running compiling the up and running it. Okay. And now we can see that we have the effects. Take photo wreck and siege camera. Okay, which is school? Okay, great. So we will go back to work. So the under this to d i e and here what it will do. Well, go be Go to main activity dot Jabba and then we will go to the resume meets held right here . As you can see. And inside these Mita we will have the new bottom we just created. So, after you take photo bottom, we will add me Bottoms going to say final Barton record BDO Barton Okay, we will said Thies define view by I b r did 80 that record video. Okay, they were going to say record video button that set on click Lease in there on publicly sinner new Uncle E. Gleason there and inside thes we will create a Mito which we will use to record bebop. Okay, great. The first thing we will have to know if the application is already recording or not when we click on the spot. Okay, so for done, we're going to create a global horrible A global and Boolean variable, which will call private private Stop, take bullion. He's he's recording these record. Okay? And as default it will be set the balls right. Okay, so we go back to our, um, record video button right here. We can continue inside the on Klay commit. So we're gonna check Eve. He's recording. Okay, so if he's recording, what we gonna d here we will stop the the BDO, right? Okay, So if he's recording, we will to stop the video. And if it's not, we will start recording BDO. Okay, So, to record a BDO, what we have to do is we have to create a media a recorder. We will create that as the global viral, too. So below the easy recording barbell, we're gonna tie private static media recorder. We'll call it recorder and we will set these to know to know. OK, okay with me. See? Said to know. Okay, so we have created our record here right now. Okay, we cheese. Great. Of course. So the recorder is created, but Now we have Teoh initialize it right here. So if it is recording, we will stop it. So we're going to say, um I m media recorder. Oh, we have two. Great. It a new recorder. Right? So, um, let's see that. See? Let's see. Let's see if it's if he's recording, we will stop it. Right. So to stop the beat the recorder, you got to say em are actually recorder. Um, that stop call, the stuff may tell recorded at stop. And we will also create a mito that will enable us to release the media recorder. Okay, so we're going to go after the under Sumitomo and right here we gonna say private static. Avoid Release me the our recorder. Okay, we will open the Mito and inside here, we're gonna say, recorded that reset. Okay, then you're going to say recorder that release, I'm going to say recorder equals goal. And then they're going to say I am a camera. Actually, my camera also the camera is not stopped Excitement of access from eight from here, So maybe you can make the camera static so we will go Teoh here instead of private, We will go say private static camera. Right. So we can go back to war. Released me the recorder meat sales right here and right here. Gonna say M camera, that lock. Okay, so that's basically our relays released. Media recorder, meats. Right. Okay, so right now we will continue working in the in the video recorder. So if we go back to the, um, record media button and in the east recorder if statement we first said recorder that stop , then they're gonna called immediately created, which is released media recorder. Then we're going to say, um we're gonna say he's not. He's recording. We'll be set to false. Okay, Okay, that's it. Okay. And now what we're gonna do is if it's not recording, we will do the following. So we will create a mito that will enable us to know if the media recorder is prepared or not. So we go again outside the own resume meter and rained here. We got a time Private stock, Teak bullion. Free, fair. Be video recorder. Okay. And inside these Mita, we're going to say the following recorder will be set. Teoh new media recorder. Okay. They were going to say M camera that unlock. Then we gun say, recorder that set camera m camera. Okay, then we gonna said the rodeo search suffered. They're going to say, recorder. That said all of the Acer's Oops. How the servers, okay. And whether gonna t here it's gonna passed me yaar recorder that Oh, the Acer's that come quarter. Okay, so we're setting the outdo service right there. Now we're gonna set the BDO, sir. So we're going to say recorder. That said BDs er's hoops said bdo sirs, and we'll set these Teoh me the art recorder that, um VD Acer's that camera. Okay, great. Now we gonna said the profile off become quarter. So you're gonna say, recorder that said profile inside these were going to say, come poured or profile over. Come quarter profile that get and will say, come quarter profile that, um, quality high for no. Okay, It's a high quality video. Okay, then you're going to set the out boot files. Okay? We're not gonna said recorder that set out food file said out file and they will said eat Teoh. The meeting we created previously week was called SE file and this parameter move fast string. Oh, sips, sips string that value off Okay, in the past environment that get external starch Public directory. Okay, so I will be these Name me line for better readability. Okay, so get external storage public directory. And we got a posit environment that directory movies, for example. So there's the directory that we will pass these two. So before the last parenthesis, we're going to say, Plus that I am be four. So this is the output file or going to be using on the extension off it. He's an MP four Beat, you vile. Okay, then you gotta said the review these play for they're gonna say M media. Okay, Sorry. Recorder. That said preview display. And he was going to say I am free. View that. Get holder, Get holder that Okay? These two meters, they go to call it metal get colder that get surface. Okay. Okay. Now we're gonna said the orientation of the's going to say I am recorder that set orientation. Hinde and Newman said these two rotation Okay, now we're gonna open a dry blocks us try open, and they're gonna say, recorder that repair, and we'll catch the exception right here. Exception e, for example. Okay. And off thirties, we catch the exception. Little return false. Which means we were able to prepare to be their recorder. And if we don't catch it, we will return through. Which means we were actually able to prepare the video recorder. Okay, so now we have created these Prepare BV recorded me too, And what we're gonna do, you know, it will be the following, so we have to go back to our, um bbo Barton. So about two BD Bolton, where was it? So let me check. So right here. So when it recording, we just stop it. And when it's not recording, we have two prepared video recorder for dot We going to say Ailes, ive, um prepare. Beat your recorder. Okay. And if it was successfully prepared, we gonna say, recorder that start. Okay, so we started recording, okay? And you're gonna say Gun said he's recording Teoh through. Okay, great. So now we are kind of set with these, but there's something missing here, so we want to record also out out the right. So we want the ulcer require that permission to user's gonna go Tore Andre manifest file and we will have an extra permission right here. Gonna type uses permission record odio. Okay, that's a permission we want. But we also have to read to get it from, um from Koth. Okay, so we're gonna go and were redefined the permissions right here. Gonna out the new one. What I've seen Manifest that permission. That record record. Odio. Okay, so now we have other the audio permission right here on the less checkmate we have in there . Right here. So what's going on here? So there is an eat me missing here, so else eat, okay? And no, it is fixed. Now let's run the application and check that the compiles first of all and then runs correctly. So we're now compiling the up and installing it to the emulator. And now the obvious, Ronnie. Okay, so right now, I will click on the wreck record, and we coven there. Okay, so we have in there. Oh, maybe because we haven't increased the permissions count. Say, for God's doing that. So we're gonna change permissions count from 3 to 4, because now we call for permissions. Okay, let's check. Let's run it again and check it. Now. The up works so it seems told India off and now I will. So the organ permission is is asking Now I will allow with theology permission. They click on the wreck and it should be recording now. So let's see. Let's see. As you can see here this is the BDO and I. Creegan drank again to stop the video which hopefully will work. Okay, so now to check you feed the works or not, I will use a file monitor. You can use whatever from one you want, so I will use thes files application And inside these I will go to our main directory on their movies hoops on their movies And here I have a video. So I open the BDO and let's see if you if it is the video week recorded previously on its not working a suspected. So the big is not running very well. May be it is because the emulator So maybe it is not possible todo it is not possible to do that in the emulator. Just maybe, OK, um so to be sure, let's go again. Let's go back to the app and let's a quick maybe switch the camera and tried to record with the other camera to see if it works. Okay, that's gonna click into Rick. So you can see that there that there's sort of a lack a rate here. Okay. So quickly Again. So maybe there's something that is wrong with bees record and feature something. It's not working as suspected, so to try to fix these. Gonna doing a rig again. Okay. Kind of locked kind of block into your trap. Okay, So we will close all the ops and I will open the camera again. And now I will. Sweet camera if he works So sweet Camera and Vliegen wreck. And hopefully it is recording. And now perfectly can wreck again. Hopefully eat stopped recording. And now go Teoh our, um, files application and I'll go again to the root directory on their movies folder. And as you can see, the BD is actually being recorded because we have here a mother video. So let's see if these time So as you can see, it is working these times that here we have the video were recorded previously, okay. And the previous one. Okay, we also have these other bdo so great it's working. It's working. But sometimes when the uppers resumed, there's some box. But in general, it's working, which is the important fact. Okay, so now what we're gonna do you is actually clear. The coda beat, make the code more usable and all of that. For example, when we are recording sell a trendy at began to check this. So when we are recording, we don't want the other, um, the other buttons to be available. So if we click on the wreck, the other bottoms should be hidden dry. So let's try to do that. Okay, So right here, let's check. How can we accomplish this? Okay, okay. Okay. Okay. Ah. Okay, so on the on the on the record, start recording thing right here. What we're gonna do, ease following. So when we start recording, we have to hide the other buttons so the one will be effect Barton So effects button Who set piece ability to go on. Okay, so that's the first. The other will be take photo bottom. Also set piece ability to go on. Okay. On what else? Waas. So facts take photos and switch camera. So sweet camera button. That said BCE ability to go on, okay? And when we stop the record and we have to set those bottoms back to be civil states are going to say effects button That said, BC ability to be Siebel Gate Then you're going to say Take folder button That said, Peace ability to be simple and also going to say sweet camera button that set bc ability Teoh Be simple. So now we're going to run the app and check that these new feature is working as we specked . So it's being installed. And now let's check your feet works. So right now we're here and I fee I breast on the wreck. Then, as you can see, the other bottoms are hidden and I FAA pressed on it again. Then the other buttons are shown, which is awesome. Now something. Now that we want to do that when we when we star direct button, we want to change what the bottom says. So I'm going to say record BDO Bowden that set text and you'll say, Stop wreck, Okay. And when we go to back to normal state, we're gonna say record, be the button that said Next rank. Now let's run the up again. Check these works as we want. So of me stay semi colons. Let me see. I have to fix this. Where did that means it? Okay, right here in stub. Bricks of semi colon. Let's run it again. Gay Compiling, running in Stalin. Okay. And now let's see what these going on here by prison. So let me changed these, okay? If I present wreck, the bottoms are heating the buttons. Air heating, Andi and he says, Stop Rex of I pressed up Breck, bottoms are shown in These goes back to wreck state, which is grades, right cell with chunky Vicodin. Continue to move the camera. Yeah, Apparently it's working. Okay, great. Which is awesome. So these for these BDO I hope you enjoy it. And the next BT will continue to do some improvements. And to the cold. You'll I for application. I hope you're enjoying. And I see you in the next one by 7. Fix Bugs and Improve UI: Hello and welcome to the new under development tutorial. Thesis part seeks of house making camera application for Android. We'll continue to clean up the Koth to check for stability issues and optimization deeps. So let's gonna run the application to see if it works in the emulator. So right now I'm building the op, and I'm waiting for it to be compiled. And then I will check if it works on the emulator so we can do a lot of stuff here. We can review, I we can improve the Koth. We can improve, um, fix some box. Maybe that we may find And all that related so and actually believed what? We don't need some dependencies. For example, if we go to our build upgradable file the 2nd 1 Okay, let me see. Okay, so the app is working right now, so it has Ron. And as you can see, the camera, he's working. OK, but now let's go back to the, um 200 studio I d. And if we go here to our build that great will file, we have some stuff we don't really need. Okay, so we are not testing. We're not used in these test things so we can believe these lines. And we are not using these parameters right here. So we can also delete these lines under for us to understand better on. We are also don't you not using these Paris line were using the APP combat line, so we'll leave that. And that's everything we're using. Actually, we're only using the app comp it library TV. So right now, as you can see, we have or filed a lot more clean in which we only s busy. Five of things that we actually need for the application. As you can see, the sink has finished. And if I run the up again just a chap, just a check that everything works. Fine. Let's see. So right now I'm run in the field, the great greater build. So I will wait for it to be completed and we will check if eat works or not. As time of recording the last version of under these 28 the Turk Daisy K. So if I go to the application as you can see, eat works steel great, without all of that dependencies that we don't really need. Okay, So the effect says that as I told you and on the working day emulator and take photo it it works. Okay. We may see a day when I recon take photo. I can see that this kind of freezes a weakened read record. You can see it's recording. Okay, basically going to stop. Okay. A big legal switch. Camera record recording on take photo. And when I present take photo. What happens is that eat freezes the the u I. So you have to fix this because when we take photo the your eyes priest. So let's try to fix this, OK? Right now we can close thes greater file. Okay, I will go to Maine. A TV to file and it will check. Maybe we have some error in the take photo bottom. Right here. So we take the photo on, then we start preview. Okay, let's run the out. Check that everything works. Fine. Okay. So Okay, I am moving right now. Gate moves and I will take a photo and eat is not moving anymore. So maybe the problem is with these start preview, I will come in thes and we'll run it again. Jackie, Feed works or not, gate. Now I'm running it again and I can move the camera. I will likely come take photo, and I can not to move the camera anymore. So the problem is not their friendly. Okay, Okay. Okay. Okay. So maybe somewhere else, maybe in the m picture object. Okay, so here, with these dust, is when the victories taken. We do all of these, and here we have Teoh, maybe do additional something digital right here to fix this problem. Okay. Okay. Okay. Okay. So we ride thes file and we close thes but then it's not working. So maybe if I Okay, so the piece de preview is another working very well, so let's do something else. So let's run the up again. Okay? Okay. And now we can move. Okay, a likely come take photo. It's a photo. Then they cannot move anymore. But now what I will do is they will pause activity, and I will rescind it again to check if either works again with Missy, and it works again. So if I take photo here, 8000 work again and if they pause and resume e works again, so we kind of have a hint of how off? How to fix this problem. Okay, so when we recent these we can we can go back to the normal state of these. Okay, So the kind of quick fix for these with me to call the on recently told scores that not That's not very elegant, but let's see. Okay, let's see if he works. Okay. So after we take a picture, we will say on resume and we will run the application to check feet works or not. Okay, so let's see, We have the camera, which is working. I will take a photo and it's steel works after taking the photo. So we have fixed the Bach, but maybe not in the optimal way. Okay, but it's face never less. Okay, Fight, present recording. And I stopped recording. It's It works if a sweet camera record stuff recording and we have been there. Okay, so we haven't there right here. We have to figure out what ever waas that. Okay, So if we go to our love cat and look for errors, we will kind find what happens right here. And e cast a wrong time. Error in reach. We stop the recording. OK? OK, Ok, OK, OK. These may be related. We'd be on resume. We just out it. So if we're on the up again, we will try to record we doubt the own resume me tothe. Okay, So very press record. Stop. It works if I Sweet camera record Stop steelworks record. Stop to work. Switch camera again. Record Stop. It's in the works. Which camera? Again? Record stuff works. But if they take photo then to go when I take a photo, it goes back to the to the first camera, which is not cool. And if I click record in the stop, it works. But when they switch cameras, let's see. Record stop. Still work. So there's a couple of things we have to clean the gold. So the code is being Macy. That's why we have these errors just because the corrupt the code is not to really ordered . Okay, so it will be cleaning out the cold. So we started. Really? Don't create me. Told the only thing we do when we all create We said the conference view to our delay of that activity main okay and configuration changed. We rotate the camera. We don't do anything else right there. So, permissions, everything is fine with those me tells. Okay, the first thing we gun we want to working will be the on a resume. Mito. So the first thing that we have in the only assuming tell easy permission check, which is okay. And the next thing is e we check if the camera is initialized or not. Okay. Okay. So what we have to do here is clean up all these code rate here. There are some things inside these if bracket that we actually need on others that are not really needed for deadly will create. And he needs me tothe Okay, we will create that. Any of me told before the on recently Telenor for us, too. Better visualize it. We're going to a private boy. Eat it. Okay. And this Heidi's me tell we will do so many south realization. Okay, so basically, what we will do is will move everything inside the Eva statement everything. Everything, everything way. We'll move all of this to our initialize me tells to our in a meeting with Okay, so we have moved it. So now we have on under Sumita that its way cleaner. So if camera is not initialize, people call in it. Okay? And else we will kind of open the comer. Okay, so basically a quick fix for days will be to say, open the camera and and basically irritated if we have to. Okay, so now let's simplify the He needs meat because it's kind of a very large Mito. The first thing we will do in the in its Mito wheat open the camera. Okay, so first, after doing this way, will delete thesis camera initialized it through, and we will put it on the under assumed mito. Okay, if this camera initialized, we call in it and we will set its camera initialized through. Okay, Great. So now we can go back to our units meet, told and start cleaning it up a bit more. Okay, So here on the Mito, the first thing we do is we opened the comer. Okay, Well, geez, Okay. And makes lots of sense. Then we created camera preview. We find the preview, we have the beauty, the preview. We retained the camera. We said, if lodge and all of that okay, but all of these things can be moved to an inn. It camera metal. So we will move all of these lines before we define the switch comer bottom to another Mito . So we'll be private boys. He needs to come. You need to come. OK, so you need camera and we will move the me tell just there inside that you need me to call . You need to come. Okay. And then we said the league listener for the switch camera bottom in which we released the camera switch camera and rotate the camera. Okay, then we said the preview display. Okay. And we start preview. Okay. Which kind of words, right? Yeah. Then we go than the effects button. We do the same and then we check if we don't have effects. We said the effects Bottom t gone on the take photo Bob way are calling under assumed. Now here, Instead of calling on resume, we should be only calling any camera. So you need to come. Okay? And we will delete thes m camera that start preview, so that is a lot more efficient. Course, you have to test many that works or not. Okay, so the media record Earl of that works looks great. Okay. The orientation event leasing There also looks great. And the young love leak leasing there and changed the focus that we haven't tested. Thes. I forgot about these. So let's run the up again to check that it works as we want. Okay, so I'm running the up right now, and apparently it's working so far. And if I lung Klay Candies, I don't think that simulate emulated in hardware IMing software. So in hard worried may have an effect. OK, but now if I take a photo before is taking and we steal have the ability to move around recover, which is awesome. Now I will pass to check if it works of positivity resumed activity and sadly, 8000 work. So we have to fix that too. So if we go to the on resuming me tailed right here when the camera is actually initialized , we will call you need to come. Okay? And we will Iran be up again. Check if that fixes the previews error. So we're here and we want to pause the TV tea and Reese emit to see if it keeps working. So pausing resumed and yeah, you keep working. So we have fixed that too. So let's go back. Teoh from the i d to keep cleaning up the code. Beat more. Okay. See? Okay, so right now we're right here, which seems to be working Great. Okay, so our code is now a lot more cleaner. Okay, Okay. Okay. Take photo bottom. Also working. Repair video recording. Also working on picture taken. Also working. So let's tests the app a little bit more to find, maybe more box. So now we're insulting the UN began and I will actually moved to the file monitor. So I will open to file manager and we'll go Teoh, our main folder under pictures and easy. These are all the pictures were taken with the camera, so I will delete all of them. So we can We can basically see the new pictures if the pictures are being saved or not to the device starch. Okay, so all of them are selected week. Weaken the lib 13 files. Yes. Now we don't have any more pictures. Now we go to movies. We will also delete all of the's movies right here. So select all delete and OK, so we don't have more movies are pictures what we'll do now We will open the application again and take a picture, for example, that Steve, let's move the camera. So let's take a picture right there. So take photo. Okay? And now I go to the files right here on pictures. And as you can see, I have the file I just taken So photos working, we'd be back. Camera. OK, but there's a problem here. As you know, the orientation off the photo is not correct. Okay, so something is hot is going on there, but well, we will continue right now to the camera. It will sweet to the camera And take another photo right here. Okay? And who go back to files and try to find if we have these other photo which also works. Maybe the problem with these used is the the orientation of the device. So what it will do will go to our 100 manifested XML, and we will set the orientation two portrait. Okay. And we will delete these gun few changes thing, and we will go back to remain activity that java. And here we will also delete these, um, kind of un configuration changed. Maybe this is a problem, okay? And you around the ab again to check your feet. Words. Now, hopefully. Okay, we're here again, and I will take another photo. Okay, photo taken. Now I will go to your file manager. Okay. File Manager and Jackie read the works. And yes, As you can see, it actually works. So that the What's the problem? The picture is now on the correct orientation, as you can see and that. So let's keep testing these. It's in order to avoid confusion. I will be lead all of them again. So gonna say so. That's all lead. Okay, Go back to your camera. L switch the camera. Switch camera. Let me see. Speech, Camera. Okay, dig photo. And when we take a photo than we are going back to these these other camera which we have to fix it so defeats Dad. We will go to war the e and we will do the following. Oops. What's going on here? Okay. Okay. You okay? Okay. Sorry. Now I'm ready. Okay. So when we take the photo, something is not wrong. Is happening. Which is thes e need. Come. So these unit come, He's opening the previews camera, which we don't really want. We want to sweet camera. Okay, so let's kind of find the switch camera. Baden. Okay, So sweet camera. So basically, we want to do bees. Okay. When we eat it the camera. Okay, so we go to camera in its indeed come right here. And instead of opening just the same camera, it will check for the flock and open the corresponding camera. But here we will rebirth the flock because we don't want to. Sweet to them, we want to open the current one. So let's try to see if that fix work. So I'm now running the application. Okay. Okay. So I will try to move. The camera still works. I will take a photo with the main camera and the words, they will switch to the secondary camera in front camera. It will take another photo. And as you can see, it stays on that camera. So apparently we have fixed the problem. Okay, which is awesome. So we now have fixed the problem and were able to continue developing the application. Okay. Okay. Great. So now that we have done all of these, um, let's we don't really need that other things that seem so, so So we don't really need the orientation lease in there, because with them really want to rotate the camera right now. So we're gonna leave all of these and apparently is not compatible with the emulator, so we will delete it, and we will also find the global horrible That is these And on the pause, maybe we have a nearer here. Okay, Okay. Okay. So right here on release camera, we will also delete these. And now that's run to Jackie Feed. Worked or not. Okay, so we're launching that TVT. Let's see if it works. OK, switch camera. It still, it still works, which began any steel works, which is awesome. You will record stop recording. And now we will go to where the files application application to see be recording while saved. Okay, we will go to you main folder movies, and it will open this. And as you can see, there we have or video, which is awesome. So to make sure the media worst, this kind of a recorded a larger BDs so sweetly camera you will present week recording. Okay? And now we will press. We will move around the camera. As you can see, focus the dog. And now we can stop the recording. Go back to the files up and we will select. See if the new video is here. So this is not the one we want. So he's the one we want and burn. Plea. It's working. So that's the BDO we just captured with our camera a couple of seconds ago. So beefy. Oh, he's also working. We have photos working switch camera, working videos, working, Bernes, Lee, everything. He's working. Okay, so, basically, let's check if we can find some nails. Maybe we can improve the you are a bit more. So let's check the up right here. Okay? Maybe we can make the farmed off the taxed a little bit smaller, so it will feed better on the textbooks. Okay, so let's do that. So to change the form, people go to our activity. Made that xml and first sample, we will do the following. So starting with lodge, we've got to say text size and well, maybe he said it. So any sp, I don't know how big will be to any SP, but Okay, let's let's do the same with effect right here. Hopes observes. So specks size next size. The NTSB. So I will run. Also, it depends on the device to running. But for now, I will use to NTSB. And now that see the text size off effects. Okay, let me see. And it's a lot larger. As you can see, he's very large. So we needed smaller next size. So let's, um, switch here. Okay, So that size well, we should be using. Maybe should be around 14 or something. So let's try with 14 to check if you work. So 14. Now, let's run the off. And as you can see, it's not enough. It's not enough. Maybe we have to go down to 10. So 10 should be should be enough. So let's run the 10. Okay? Okay. And as you can see now it feats inside the textbooks, so we will do the same with the offer. Bachmann's? Okay. Let me see what's going on here. Sometimes you blocked me, but Okay, so now we'll do the same with the next button. So everything we were set to 10 SB, everybody, maybe for some devices that could be to Lille. Some maybe so any would be enough. But for these device I'm using need will be tennis be so 10 SB apps symptoms text size can best be. And here we also have text size tennis be and that's it. So let's run it again and check it. Beat words And as you can see, you know all the taxed feats accordingly. So these doesn't then later that eats kind of app scaled in the refer you guys to see better But you shouldn't use that tiny, tiny phones You should use kind of a larger phones. Even we have awarding rate cured. It says avoid using is muller than 12 SB. So if we go and switch to tell us be, let's see what happens. So let's switch all of them 2 12 sp Okay, now we have also the fragile and we have to switch these two. Tell fist be we will run it right now and check how it be caves. Okay, so right now we're running it and Elvis be still looks great, you know, still looks great. You can change in your device as I told you, but well, we have these features on riel devices We will also have the flash feature enabled. So that's it for these tutorial. I hope you enjoy it and they see you in the future to target sense for watching by. 8. VIDEO PLAYER! Setting Up Permissions and UI: Hello and welcome to these. Do you, Andre the bellman Curse Thesis part one of how to make you beat your player application for Android. So we're going to start by opening or under its studio environment and start and clean to start a new understood your project, we will select Empty a deputy and then we will click on next. If you re changed, Name off the application. Teoh beat the old player. Okay. We made sure the language that he selected is the job of broken me language on Didn't my prayer level these at least 16? We will click and finish and we will wait for the project to be loved it. So these project thes application will basically do two simple things. The 1st 1 is getting all the end before files are other compatible BDO files and then it will enable the user to play those files using the default be debut which it which is the default way to play video in android operating system. So right now, as you can see, the project has finished loading on the first thing. We gotta do east to change the route element of for XML file For that, we will go to the left under dress folder and under the layout folder, we will find activity main that XML file. We'll right click on it and then we'll click on delete if we have. If you have these options checked, please check them. Press in. Okay, now we have deleted that layout file. As you can see, we have a narrower right here, which is normal. And now we will create it again. But with different route element. For that, we right click on the layout folder Here it left. We right click here we go to New and lay out the research file as the file name. We will write the same. It was previously, which is activity activity main, um, made it feels like base. And now we will change the route element to lean your layout. Does you get you right here? Now we will leak and Okay. And as you can see here we have our new Lena layout XML file. If we switch to text mold, you can have that. We have. Um you can see that we have these leniently out is the root element off work layout. If we go about to your main integrity. That Javal, we concede that these red warning disappears, which is cool for these. A thorough I will be running the application on an emulator. You can do it in the name later to or you can do it on a really buys. Right now I'm starting the emulator in order for us to make it faster in the future Apple launches. So the emulator is starting right now. I will leave it, Teoh load in the background of Missy. Okay, so it's loading right there. And as you can see, half sent the up to the device. But now we will leave the emulator aside for a moment and we will fuck use on or application. So, as I told you, we have to first be able Teoh to get the files for that. We will go into our money first file right here, and we will have the read and write files permission. Okay, so we go ahead and start by saying, uses permission. Okay. Uses permission and we will specify the wreaths and write permission off our storage. As you can see, the I d doesn't Outer generated these for me. because it's loading and some nails right down is insulting Day PK. But now that it has finished installing it, um, I can start, get in the the help of the A B Right here, sir. Go say uses permission. And we got a type ride. External storage, as you can see. And after data, we're gonna go and say uses permission. Read it, Sternal storage like that. Now we have thes right here on the the activity right here. You can see that This kind of highlighting gallo. So this is just a warning for a Google search or something like that. We don't really care. So we can just click and suppress warnings right there. And now it's everything normal and right here we will also said Thies, screen orientation to portrait because that's the one we will be using. Okay. And now I will actually run the app on the emulator to see if it works or something. Maybe it's not working, so I'm compiling it. I'm installing the A p. K, as you can see, and soon it will run here at the left, as you can see, is a simple thing that has nothing on it. It only has the video player title on also house the status bar title. So I will remove both of those bars to remove those bars. We go under duress folders and under the Bali's folders we opened this tiles the XML file right here we can modify our style. We will start by typing item window no title and we will set these value to through as you can see and we will open another item and he will say, um full screen with the full screen. We will also set beast True Now on Lee, with those two lines we have removed the bars so I will run it does that worked well So I am compiling the up. It's now sending it to the emulator. As you can see, it is empty. Everything is just a white rectangle. So it waas the titles bars. The previous two bars were removed. Okay, so we go back. We can now clothes, styles file We can no clothes the's manifest file And now we will have Teoh Teoh create a way in which we can ask the user for permissions actually. Okay, so we have Teoh. If we are targeting marshmallow or higher, which is pretty common these days. We have to make sure that we ask for permission. So that's a very, very important, I think, to keep in mind. So we will be asking for permissions and creating a dialogue that we last. Hey, we will use these permission and the user will will quicken, enable or allow or not allow the permission. Okay, so this is the own Create me told right now we are in the main and TVT felt Jabba file after Dad, we will start actually cold in the first thing. He's a coat that will ask for the permission. So the permission request code for doesn't define it. US private static in, um, actually private study final. Because this will be final values brighter study final aimed and he will call it in. Upper case and capitals requests, permissions, permissions. And we will set this body Teoh any I d fire. For example, I've said it to 1234 Okay, Then we will create an array of strings that lose specified the actual permissions that we will ask the user to grunt will go and say private static final But now String. This is Stringer race. It was Ray right here, and we will call this permissions, as you can see, open brackets and we end the line with Semi Colin. And inside here we will go in type mani fest that permission dot Read external storage, as you can see, will tap a comma, and the next line will type manifest that permission. That right, external storage. Okay, so now we have is busy fight the request code and the permissions we want to request. We also have to specify the number of permissions in these gays. Words were asking for two. So we're gonna go ahead and type Dr Butts static, final eat permissions count. We will set these two to. Okay. And now we will last for permissions. And we will be preparing to meet out the first meet. Sally will use east check if the user denied any permission. So for dollars creating following Mito, private Bullen bleach will return to our fourth whether the permissions are denied or not. So we will call this art permissions denied. A Z can see right here. Okay. And inside these, we will We will write a for loop So go ahead and tied four. We open princes and five int I equals zero hopes, equal zero semi colons. And then we go and say I last the permissions count. So we will check these for every permission. Okay. And I plus I plus gloss, as you can see it right here. Okay. Okay. And inside the these four group, we will check if the user has granted permission or not. So for it, I will go ahead and say, Chief, check. So if jack self permission and we will pass to the current permissions, we keys Formacion the index, I Okay, leave check. Self permission. He's the for rent, then blockage monitor. Okay, it's different. And package Monitor that permissions granite. So basically here, whether we say in ease, if if the permission is not granted than do something. Okay, okay. Pretty easy. Right. Okay. So the permissions he's not grabbed it. We will return it through because we're returning. The permissions are not granite. Okay? So that the name of the Mito are permissions denied, So if they're not granted, they are denied. Okay? And after 34 loop, we, of course, have to return falls. These means there was no permission. Denied. Every permission was allowed, as you're going to see here, we have a warning that says Cole requires a p 11 23. But we don't really care about these warning because we will call it on Lee when FBI level these doing three or later. So we can go ahead ins and say, suppress. Leaned, You know, maybe I annotation. And now the wording is gone. So this is the first meeting to check the permissions. Now we have to also check for another meeting, which will be called when the permissions when the user, um, clicks denied or allowed permission. So we've got a type override public boy on requests. Permissions result. Okay. And as barometers we go with, say, final eat, um, request code. So this is the cold that we pas. We will check if the's gets past the code that we passed previously. Okay, so that the request code finally request called vinyl string. Okay, Hopes it's a final string array permissions and I go to neckline and sales are final themed array grand results. So these are kind of the parameters that we live past these meets now, we have Teoh were writing it, so we will have to call the Super Mito for double Goldman. Say Super that on request permission to result and will pass the same parameters. So the 1st 1 will be request code. The second parameter ruled pas will be permissions. And the third we will be grand result, as you can see. Okay, Now we want to go and check if the request code is actually the same that we sent. And we will send the east code right here We keys. 1234 Which called request permissions. Okay, so we're gonna go and say ive request code if request called, um equals, if it gresko equals request permissions. Okay. And we also check ifs, ive and grunt results. That length is greater than zero. Which checks if the results are not empty, basically okay. And inside he will have to check if the if the permissions are denied or not. So going to say if our provisions denied so called me totally created previously and cue, what we will do if the permissions are denied, will be that we will. Well, the up cannot work without these permissions and if the user denies the permissions than the up is not useful. So the user should allow the permissions in order to use the app. So here, as a quick Fikse, we will open Teoh apprentices, as you can see, and inside the Iran will going type activity monitor. We go outside these and type objects that require non No. And we'll tell these that get system service, get system services you can see. And what this is doing is basically telling the system to delete the the application years or data in order for enable us to keep ox asking for permission every time the user lunches . Thea Okay, just a quick fix till we're gonna say DVD service will basta parameter right here. And after these three princes, we're gonna tied gods clear application user data. Okay. And as you can see here, it has a kind of warning again that requires FBI 19. But we will only call days if a being is greater than 23. Actually. So we going clicks, suppress, leans warning. As you can see, a can put these in the line for you to see better. Okay? No, that that happens now. that happens, Ive the user denies thesis and to clothe the app we will just type recreate basis and else right here What will happen if the user actually enables or allows access? If the user allows access for does permissions, we will call the UN resume Meet oath reassume, meet oath As you can see right here now scenes we called the unr assume Mito We have to overwrite that and that meeting will be actually the main meet with ofour activity. Okay, so for daddy gonna go after these and type at override, then protected void on re soon under assumed we will open days in type supper Super that under soon. Okay, so now we will hear you. These were when he's where we did a check off the Andre version to check the current operation, the foundry will type the following Revealed that version um version docked as k eat. So he field that version that educate een is greater or equal. Then yield that version codes that m which means marshmallow. Okay, so we check first if it's a marshmallow, are or above and we also check something else and our permissions denied right here we will request permissions, table type request Permissions will pass permissions the request permissions called, which is request permissions, as you can see. And after these we will returned. Okay, a simple is that And we also have Teoh. Check these every time the honor assume is called because the user may disable the permissions for application. So this is basically how we do it. Now we're gonna check if the up was initialized because the under Sumita we were called many times. And we just have to initialize the up want for that will create a flag which will be called Private Bullen. He's he's beef video player initialized. Miss it. I have a table here. It's be a play here initialized And these defaults to false. Of course, in Jabba and after D's After inside the owners of Mito, it will check ive it negation is BDO play initialized, which means if it's not initialize, we will initialize it. Okay, so first at the last line of thes statement, we will say that the media player is actually initialized. So well said these two true Okay, so right now we have these right here and to initialize thes will have to actually have some. You I elements, the first thing we will do is to least the videos. Okay, so that leaves the videos. We will go and create at least view. So go inside. Other than the layout and type least view with much bar and height. Zero b, wait warn. Okay. And we will. At the 92 least, Teasley's beauty will be least view. You can see now we go back to remain a DVD about Java file. And right here we're going to say vinyl, at least view. Please view Lula societies to find me Why i d r did a t that please view as you can see. Okay, so now we have our least you right here. But we also have Teoh create the items that will be displayed on the least view in these gays. Beat your name and the extension of the video, for example. For about we open the layout folder, right click delay of folder and click a new layout reserves file and we will create a file name type item and the root element of these will be text you because it will show text as you can see the item is created right here. I can close the preview to see better to code right here and inside this text view element right here in at an I d. These I d will be, um my item, for example, or something like that. Okay, so now we have created these item which should be access for more main activity, that you have a file. Now, the height of thes could be different because we didn't want it to be much borrowed. Maybe you can change the height to 50 dp and as you can see again, isn't really new line in order to make it easier to see. So we can basically with the much bar and hide TDP. And we also want to send to read vertically. So we're going to say gravity center vertical, as you can see right here. And maybe the default font size is too small will increase it by saying text size and well , go and say to any five SB maybe not. Maybe 22 speed will be great. Okay? And I will leave it there. Maybe we can change the color too. So gonna go say next caller and we will go on defined the color for that girl under the body's folder colors XML file Who open an element named Kohler and name of the element will be black. Did they find the black color in Hexi Decimal RGB values with We go inside the number sign or hashtag and they're regarded side stick zeros, as you can see and we define the block color. Now we're going on item and index color Real type black. So that's the cold Really find as black as is the preview here. You can see besides of the text view any invite attack. So let me increase thes the size of these as you can see right here. If I had a text field right here like hello, he recovered thes but busies um not nice because it doesn't have margin. So we'll have popping actually. So potting and we will ask, um, putting start button start. We will laugh. Tandy p maybe 16 dp Okay, 16 dp You will also add padding. Um, bobby left 16 pp which in some regions of the world these is used there some android versions. I will also add padding at the end So we're going to say fighting end 16 BP and Parveen, Right? 16 Be okay. Right now we have our hello Think right here. We can now just delete these. Hello, Tax, Because we don't need it for application. And they hope you enjoy these BDO. In the next video, we will initialize it least BBT files and start doing more features. I hope you enjoy it. And they see you in the next one by 9. Creating the Video Player ListView Adapter: Hello and welcome to the new Andre Development Tutorial this part to you of how to make a video player application for under and produce to turn we initialized you, I and some elements as well as asking permissions and that kind of stuff. Right now we will continue working and you're up. And for these we will goto main activity that Java file. As you can see, we previously initialized police view right here and now we have Teoh initialize the we were created the adopter. So what's an adopter? Well, in a doctor is a class that said the elements or the information in every sell off the least view as Edie's required. So it depends on which part of the least be the user is navigating at any given moment in time. So that that's a doctor who figured it out and actually sat that the needed and required information for that little quick creating inner class in order to maintain everything on a single service file for simply city. We go and say class and we'll call this text doctor because the doctor that will show text what what is the tax we were showing will the file. Name off or video files. So text adopter and these we'll be said to extend. So extends base adopter, which is the base glass, often Adopter. Okay. And inside these these basic doctor. As you can see, we cover wording right here that tells us team demands Mitos will quickened up and weaken. Okay. And the meat cells will be automatically implemented for us. Okay. Before these get count me tell, we were start creating or metal for off are on own, which will be the set data meat told for down. We have to create a global barbell. That will be fine. The data will be using for that was, say, private, at least off string. Okay, call these data. So it's in the rail east of strength. Okay, which is great. So make sure you important these great here, so make your important the least think and diaper string. It's called data and ruled. Set feast New Our A list, as you can see. Okay, Right now we're inside here and we will create our set data. Mito for Donald type public void said data. And inside it thes we will. We have to pass some data which will be passed from outside from the outside world to call that way. That data eyes on the release, of course of streams. Okay, I have to use the same type. And these will be called M Leda for us to be clear with what we mean. No, we now we will set and check if everything is ok until we will go and clear the data. For that, we go say data that clear so clears the previous data, as you can see And well, uh, all the data that we can't right here. So you're going to say data that at old and is that here we will say I am data because that's the parameter that its past. And after we did these, we will tell the adapter that we have new data for that. There is a default meeting we have to call, which is that if I data set changed and that will be eat for our set data Mito on the get count me tailed. So these meets a little bit cold by the lease be to know how many items do we have? So that will return data that size. Okay, pretty simple. You get item. Uh, meet deal won't be used for us for now. And get item. I d won't be used. Eat there. And so now we have those details. The gap be retailed is actually a pretty important one is developed afford meat. So it actually we did defines how the adopter works. So first we will check become Burt to be which is it? Be passed. If it's also go say ive come, Bert View equals no. Then we will assign it. So I'm gonna say, Come, Bert View and we'll set it Teoh layout inflator You can see right here that from we open parentheses and tired parent, which is the parent Theo Element past as a group, as a few group type. So parent that get context a tape of common instead of that. So that get context And right here. Well again, uh, close, Let me see. Covered view layout inflater from parent that get context, okay. And outside he's got a type that inflate and he will die But the name off or item, which is thes item xml right here. So we're going to say our that layout that item Okay, because that is the item we will inflate, which is times you own every in every cell of a released view. So we're gonna go ahead. And Ted, comma parents and well said, attest to root, will see, will be false, and then forget ended with a semi colon. I can put these in a new line in order for you to see what I'm doing right here. Okay, So if come Burt Bees mole, which, for example, you with all of the first time on. And when a new, um, sell comes into Faulk, use okay into scope, and then these will be called again. We will set the tag, which is there a before that. Then we will retrieve. So for that, we go and say, Come, Bert view that said, Todd and we will bus and glass the loop just create right now. So outside the get view me told will create the view holder cloud, which is just a simple glad that enables us to set the text view. Uh, stuff. So here goes a class view holder. So this is outside the get butte meet old, but still inside of the adapter. Kloss till glass view holder on. We will open brackets right now and we'll talk Decks view for example. Info. Okay. And is it constructor? Meteo goes ahead and save you holder. Positive course. That's view type will be cold in full or an info for us to verify it more. Okay, So when debut holder Mito is called, this will set info which is the outside element to m info and that's pretty much it. So now we can go back to her set attacking. We will. We're calling previously So right here and now we can say new view holder, which is the the because we just created cell Go Nube, you holder, and you will pass. Um, we will take another. Brunt's is inside. This printed will be text view outside that will be covered. Butte that ah find view by i v and he will find the actual I'd be that was inside or item. So go ahead and say item And that was called my item. As you can see right here. So go And five year I d Well type are that I d that my item, as you can see. So right now we have defined our item right there. And we can continue to work in our gets. You meet. So now after the Eva statement. So we're done. We'd cupboard view is Nulty after D's. Well, creative you holder item, which will be beautiful there, holder. Well said Thies and little Castries view to be holder, as you can see And these will be equal to comfort beauty that, um get stock. So we're getting the tabby previously created and now we will get it The item. We will get the item off thes noted for us too t know what the word or whether we're doing right here on we will Saturday. Dext Teoh They so the item we want. But the items Okay, the items will contain, um the path off the file. So we don't want to this play all that thing. We just want to display the the name off the video file. For that, we will create a string, so finals drink item and we will set thes Teoh data that get position. So we're getting the current element of the current position off the data array list. Okay, so that's item. Okay. And then we will go and and said the text for dollar go Say Holder that info that set next , we will set these two item that sub stream. So where the finding part of the whole string we want to print So substrate will be item that last index self and we'll be single Quote for was lodge and titanium type plus one. What this is saying is basically just display The names are getting the last four slash just before the names start Tell a simple is that right now we're getting these and instead of returning null, we have to return convert view as you can see right here and now, our adapter is ready to be used so we have to use our adapter right now because it's just ready for us to use it. So to use the adopter, we have to just set it up up once and we will set it up in the on resume, Mitos. Okay. And we will kind of ah link that a doctor tower at least view. So we go to understand meat inside of these ive bracket and we will say final text adopter , call it tax adopter and say new next doctor and after diesel. Say text doctor. That said data because we have to set data to something and we don't have data yet, so we'll create some right here, like saying final at least all for a raise. Because remember that lost the data type we used. And we will call these, um, be the O's least, for example, and they will be sent to new our A list. Okay. And here we will create a for loop that will populate the data. So gonna say, for eat I equals zero I a lesson, maybe 100 items. So this is just for destiny, and I lost loss. So inside these were going to say videos list that Ott. And here we will, uh, string that value off. I just for us to test, have a number index used. The index is the number of or sales. And now we have populated these. And now we have to set the data for that. We're going to say text the doctor that said, Oh, we'll review it. So said data on the data will pass. Well, BBDO is least so said data and videos, least as you can see and after these we're gonna go and say At least do that set adopter and these will be text adopter Now we will run the app and wait for it hopefully work. So now it's being compiling and running. And, as you can see it asked, it is asking for permissions. It says, Allow me to play your access photos, media and files in your device, and you will click Allow are actually just to test these. I will click the nine. So if you say, deny, then the actress closed. Okay, so if I go and search for our application, which is the biggest player I will, Jack. If the media play your he's here, right, here's a video player, and here it's asking again for permissions, and this time it will allow permissions like we can allow. As you can see, we have are released Butte working great. So we have numbered items every cell of these, he said to the index of that. So it's from 0 to 99 should be because it's 100 element, as you can see. So this is great. This is cool and now we will also be able. So when we have the videos files here will appear, for example, my video that and before and when weekly, convey that video than the BT Player will open and will start playing video. Okay, And then we'll maybe have a button that we would close the media player and naval last to play another BDs So we can make you scroll down here Glicken, another BDO and that will be played again and so wanted. So fort. We will also enable some features like renaming the BDO bleeding the video and basically that will be it. So that will be done in a future. BDO for now. These is it for these video. I hope you enjoy it and they see you in the next one by 10. Listing Video Files and Creating Video Controls: Hello and welcome to these new Andre Development tutorial. This is part three of how to make a video player application for Android. In previous tutorial, uh, we released. We created a least view with index says that goes from zero to 99. In these tutorial, we will actually leaves the files and after the files, to the least be the video files. Okay, To do these, we go toward main activity, that Java file. And right here before the under assumed Mito, we will. As you remember, we created thes object right here. The videos least. So we want the east to be accessed from outside. Um, the understand me tell for that we will delete these lines because this was just for testing. Now we can believe these lines, and we will great a new Mito here. That will be, I feel in field videos. Least for that. We're going to say private Boyd, feel videos least, and we will open a bracket right here and before these meat told we will create the global variable the least. So go and say private at least off. Oops. Private, leased off strings. And we call these videos least as you can see right there and here inside a field video leads. We will do it. Get the beauty of lease of the deep eyes and just feel it here. So here, when we need allies thes we will, um, just do these one time inside the unassuming del. So here we will go and say videos. Least Teoh new least of string. I hope so. UPS observes they did something wrong right here. So videos least should be good to new, are realist. Yeah. Okay, that's better. Okay, Right now we have initialize death, and we have After we did that, we will called me Mito. So we're gonna go say feel videos least great. Okay, now we're gonna work inside me. Tells itself to do that. We will first clear the previous previous content off the video least So we're going to say videos, lease that clear. Okay. And now we will, um, get the the videos files that X east on our Oh, now our, um, under device for that week. Fto Teoh, Get the bath off the device. Okay, so before thes thing right here, what we will do? Yes, right here. Create another Mitos which will be called for every directory once the phone to search. So we're going to say Private Boyd at videos from and disease it more elegant and simple way at the videos. So these fields be the least we'll call the ad videos from Mitos, and we have to pass a stream that will get the directory path. Okay, so the your path, as you can see right there now, inside the i videos from we will create a fire. So we go and say final file, find the file. And right here, what we call these file will be videos. Their dear directory. Okay. And we are scientists to new file, um, view path. I got off the directory, as you can see. No, we want to check if that file path exists. If not, we will create it. Because maybe default world removed or doesn't simply exist. So we're doubted gonna go say e video the year That's an ex East. We will make it for doubt ago. See videos here that make the directory. And if we're making it, it means that it is empty. Right? So right here we can just return. Okay? Because we're just making the path, you know? Okay, great. Or so these these really were making the directory, because maybe Thies is a before old path. You know it before thought for the videos to be stored. But you don't have to make director. You can just return here. OK, but now I think it will be useful to make directory. Okay, so right now we will create a file array. So released the files were filing. We find here for that, we're going to say final, um, file Array. We'll call these files, and here we were going to say, um, videos. The're that least files these released old files in these directory, which is great. Now I'm gonna created for each loop. That will best. If the file is a video file, then we will add it to the videos, least, you know, simple. Is that so? We're going to say for file file, semi colon and files very. Here's a switch into files and inside these for each loop, we're gonna say, final string, the file that gets absolute that okay. And now we're gonna do the checking right here. We're going to say he thought and we So if the thought and Swede extension of a video, for example, that MP four, we will add that path into the videos least. So we're going to say videos least Dad, uh uh path as you can see him out in a new path to the videos list. Okay, great. So these basically how we will be other videos, and later, right now we have to call that ab videos from me tilled. So when we called that at videos from me tills we have to know the directory in which were asking the application to search for, um for videos. Okay, so we're gonna go and say, add videos from So we're infield videos. Um, at least mitos and we call the videos from and we will pass string that value off, and we will buy us. We'll get it with environment that get external storage. Public directory. Okay. So I can put these in new line there for you to visualize it. Better to get external storage, public directory. And it goes, Say environment that, um, directory movies, for example could be one or download you want. We can call these terrible times. So the 1st 1 will be movies. Okay, so now we were at the videos that are on the movies folder. But maybe we also want to add the video that exceeds in the download folder. Okay. And so I'm gonna here we will copy the same thing, and we will change movies with downloads. Okay? And maybe we also want to add more video from the d seem folder. We jarred the beatings that we record Wieder camera, for example. So we have three. You cannot more if you want, like, documents or something else may be useful for now, we'll use thes three, these three directories. So now we when we caulfield videos, least which we're calling on the UN Roussin me tailed right here. As you can see. Feel videos. Least it will go and check in everyone off thes directories and well, get the videos file. In this case, it videos that and with MP four extension. And when they found thes, then, um, it will, as you can see, sending data to the text, the doctor. So it will be shown on the screen, as you can see right here. So right now we have displayed the videos, names on our at least view But we want toe play those videos because this is a BDO player. So to play the BDO, we want to know when an item is clicked. So to play video, we want to know where an item is clicked. Do you know where an itim when an item Basically, we have to create it. Click leasing There on the least view Don't you're gonna have gone ahead and say, um least view that set on Itim Bleak lease in there New on item Bleak lease in there As you can see, the i e outage in rates this coat for me and inside here these metals will be called when? When an item he's, um is talks with the user finger, you know, on the touch screen. So when an item is starched, we have Teoh are to play the video. Okay, so we haven't created the BDO player yet, So to go ahead and create video beauty first we go to remain har activity main that XML and we can did before at least views. So right here we're going to say you open an element and type video view and then with it will be much parent and they hide will be zero b and the way will be one. But we maybe want it did not be the same way. That's Lisbie. Maybe you want to leave you to be a little bit larger. So well said that the least be weight, Teoh. As you can see, there we have our BDO home the least of the videos right here. So these here will be the video and these down here will be the least of the videos to access these BDO View element. We have to Teoh Jack E. You know, if he has an i d. So we have that and I'd be so going to say I d and we'll call these i d bdo view, as you can see right here. Now, if we go to remain activity that Java file right here we have Teoh access these video view before we set the young identically Gleason there So right here gonna die final BDO view and you call this beauty of you and these will be set to find the way I d are ready that bdo that Bt of you as you can see now we have a bt of you right here and you explore what kind of off barometer beauty beauty gate gives us. So we give you, as you can see, can I have some different barometer's? One of Miami's at subtitled sirs can pause, um can seek backboards. And as you can see, right here appears the explanation of each of those mitos that can be called Okay, we can go and say he's playing on Touchy Band. We can pause the video with the central's right here. We can resume the BDO. We can seek to which means, OK, go two minutes one second, three and go to their for simple okay? And we can also save these value in order for us to use it later. So if you if you want to use later, maybe the the user leaves the AB And when the user comebacks the AB comebacks to the APP um , we want to show where the BT was left. So when the beauty of us past So we're gonna go and seek to the previews point off the videotape timeline. Okay, so we're gonna hear have ah, set media controller, which is basically the controls that enables us Teoh, control the BDO playback on Dhere. We could have said bto your eye and said video path So both of these can be used by OSCE in order for a specified to be the only one minute to play. So yeah, a symbol is that and we also have the start just started video and stop playback suspend and next, candid, more common ones. But the ones that are in bold font are the most important ones. So right now we have all these options right here, but we want to and be able to play the BDO. But as the fold, the video player doesn't have, um bbo controls. So we have to add or controls by ourselves. So the controls, like, says, pause and play, you know, the basic video controls. So we have to are those by ourselves? For that, we will create a new Java class that will enable us to do just that. Okay, so we're gonna deliver thes line. We won't leave without video view definition, and we go and open are up. Uh, element in the last, open the Jabba folder and open or name or packets name. We will right. Click on the package name right here. And we will go to New Jabba Glass. Okay, on the name of the class, we will give it a video controllers, maybe. Okay, bigger controller. OK, and we're gonna press in. Okay, so now the video controller class was created by the i D e e. So these be the controller class will extend the magic media controller class for dollar. Going to say extends meat. Yeah, Controller. Okay. And here it says that we have to implement some the constructor on some beetles, but we'll do that manually. OK, so right here, after redefined bees, we will define a context that will be used for or ops. They're gonna hadn't say context. We'll call these so context, context game. We'll leave a dart there. It will be a global variable that will be useful for us later. And then we will create a constructor meeting for the arrogance. A public BDO controller. Okay. And inside these will have to probably context, context, context. You can see right here. And he was gonna call super context, okay? And right here we have to Do you know where we will be getting BBO controllers. Sit up for that. We will use a frame Lee out that well, and they've lost Teoh change. Maybe the the size off thes view. Okay, great. So for that, we will update the contacts, the global barbell context with these new contacts. So to do that, we're going to say these that context and we'll set that context. OK, then we're gonna say frame layout that layout drums. But you can see Call these Fromm's and these will be We will cost these to frame layout. That layout parameters, you can see. And it will be said Teoh. These that get layout forearms, as you can see. Okay, great. No. The next thing we're gonna do is that we will get the be kind of a density of the metrics in order for us to show the BDO in a coherent way, you know? So we're gonna go and say these play metrics, call these Met Riggs and we will set these Teoh get context that gets resource. Is that get display metrics. Okay. And now we want to define the bys pixels in order for us to set the kind of margins for de metrics and the barometers of all of these. Okay, for that, we're gonna go ahead and say, um okay, you have metrics right here. We will create the device pixels very. Say float the P. These will be equal Teoh 50 f, which means float. Okay, then we gonna say the F pixels could float. Pixels of that will be the density off the screen, times or DP, You know, to kind of create a coherent way of measuring the screen and measure in the size of our media controller to make it bottoms. Okay, Controlled media playback. So we're never gonna say float F beak souls. This will be equal to metrics that then city times they'd be okay, which was defined previously. A safety F. Right now we're gonna go and say in pixels, guys, the amount of off pixels lee want and they speak sold, were transforming from the pizza pixels, will cast this to end, and these will be equal. Teoh open branches, which are F pixels class zero. That five. Um, if so, we are now getting the diesels and we will create the margins of these. So did that. We're going to say Haram's that bottom margin will be said Teoh Pixels. Why do we do this? Because in some devices we have the navigation bar and we want to avoid the controller to be shown below it. So we don't want that. Of course. So forums, Right Margin. So here we want Teoh, use the's right, Margene, for the same reason for navigation bar when we are in landscape, both, um, navigation bar goes to the to the right. In this case, Okay, in some devices anyway, it won't be for every device. And then, as last, we will set the barometers Hellion, These said layout. Prom's two problems. And as you can see right now, we have set the parameters of the media controller and all of these. Okay, sir. Right now we have started Teoh Implement or Beetle Controller. There is another Mito that we can have right right here, which is the set interview. We basically enables us to Teoh, you know, Do you know when the user wants Teoh change or exit the BDO? Maybe we're in full screen mode and we want to exit the video. So we wanted to have that kind of an exit bottom, so exit full screen or something of that sort, you're going to say override? Probably. It said. I'm sure view will positive you view right here. Don't forget Teoh import of you element, and inside the meeting will call the Super Me tailed Super. That set on tribunal caused lower case beauty, and now we will create an image bottom so I will create an image button that will enables us Teoh sad to view for that would go and say image Barton. So this image button will be the pardon that well enables us to exit the full screen mouth so image button and will be like exit bottom and these will be set to two new image Baden context. Okay, and now we're going to say exit button that said image trouble said image travel and you will get the trouble you see get research is that gets Roble and we'll bus um are that drop verbal that exceeds exit now we don't have that trouble, but we will create right now So to create a global will open the rest folder we go and right click and probable folder Greek, new and Greek and better ass it so these a tool does enables us to create icons, that he's kind of very useful for entree developers. So we'll greek on these, um, buttoned right there. And we will search for bottom t X eats or something like that. So exit exit to up, as you can see, so that are full screen exit can also be useful. And also full screen exit. We can. Okay. And we will change the name Teoh. Just exit and Luke llegan next and finish and Rose. You can see the error has disappeared right here. And we have set our image trouble as we want. Okay, Great. No, we want Teoh. As the background of these will be black, we want to these old to be black Suffered Ali going to say exit button that set background black browned back ground. You said this to black for sample is a color dot bluff. Okay, um we could have said to the caller like, thes you maybe have to define it color outside these things. Okay, well, let me see for w gonna go and say get resource. Is that get cold? Or are they ready? That Are that Kohler? Actually, that black will that work better? Oh, it's not set back around. He said Background Kohler. So that was my air. And you can use the previous way of used these weights. Said black hole. Okay. Okay, so we have said the color of the bottle, and now we gonna move the button are placed bottom inside the bar, off buttons. For that, we're gonna go and say frame layout. Okay. Frame layout. That layout. Prom's. Who called this prom's? It will set Beastie new frame layout, They'll forearms. And the first, which is the week we was had to lay a problems that wrap continent. Okay, so we said these two Rupp content And we also said the high to wrap confident coma, new line and layout from's that rocked content. So we positives two parameters, as you can see right there. And now, we also pause the gravity parameter so And the next line, actually, we're going to say forearms, that gravity okay, and we'll set these Teoh gravity that right? Okay, so back off set or gravity. And now we have to add the Vue for daddy Gonna say the view. Um, exit button forearms. Okay. Okay. And now we have Teoh to know. What do we want Teoh to dio when we exit thes when we quickened these bottom for that, we're going to say exit button that set on click Unclean Lease in there new on Fleet leasing there, young listeners, you consider it here and inside. These gonna create an intent that will go back to the previous activity. So the activity that will play BDO will be different from the main activity. So we wanted Teoh look different. You know, uh, primarily for the full screen video. Okay, but it will do will be doing tasks to define all of this. So we're going to say intense call these intent of committing 40 intent intent. This will be a mule intent, um, context. And we will have Teoh kind of say which application we want to open in this case will be the main activity up. So I'm gonna say main activity and the main activity activity. Okay, so gonna say main activity, that glass, because that's what they want. We want to open, and we're going to say intent that put extra, it will cost Ah, sort of. Ah, you know, a value that will enable us to know that we're passing an intent from the video activity. So, to this file, will we to define these? We will goto main activity that Java Andi Inside these we will create the video activity intent with cheese and identify your off the actual intent were using. Okay. Okay, So these video intent, we'll enable us Teoh. No. Where waas the up cold from? Okay, so we will define that at the as a eat as an integer. Okay, so we go here into main activity and say public a final means video activity intent and these will be defined. Teoh want to three first. Okay, so we go back to be the controller class, and right here, When we say put extra, we will say VDO video activity, a TV tea intent. Of course, we have to get this. And to get these, we have to import these beady activity interns. So maybe we will declare these two static so static public static, final video activity intent. And now right here, we can import. He's right here. So you're gonna say make sure we imported correctly. Okay. Come example, with your play here that may nativity May TV tea. Okay, import. Um, come that example, You play your main activity, and here we have to get BDO indent video activity intent video activity intent. So but these studies, they're gonna say import static. So that waas what was missing there so important? That static. All of that and video. Um okay, let me see video activity intent. As you can see, it's now imported, as you can see. Now we have access to that. I didn't defy your from a different class. And we will We will pass some value. The ones like returned. Oh, or something like that. Okay, so we've got to be the activity intent and we returned or something like that. Okay, Okay. There's some a right here. It says that we are not able somehow to do these. Let me see. It's doing Valley Off video 30 intent. Oh, this is not an instrument. Is in a string, really, But well, we can leave it as it is because it doesn't really matter. And now we're going to say context that started TV tea intense. Okay, these will go back to the activity that waas cold. Okay, As you can see, right now we have some sort of fair right here. It says surround with a ray. Any civilization sub renting in these new versions of 100 we have to do you create a started for Rafe intense or something. But well, it doesn't really matter for us. So we created. And so we have finished setting up or beat your controller on. And that's video. We will be ready to use it into a video player. I help you enjoy BDO and I see you in the next one by 11. Creating the Video Player Activity: Hello and welcome to these neon drug development tutorial. This is part for how to make media player application for 100. The previous thorough released the videos and we created a media controller, which will be very useful for us in this tutorial right now, If you want to run the AB, you can do so and you will find the following. So I'm running the op. As you can see, we have these black rectangle at the top, and we have the Beatles we find in or device, so make sure you download a couple of videos. I've got these videos from Axl that come. They have free videos with milk operate. So I've got these beetles from there and here you will see the BDO is you have you have to put it in one of these folders either movies or download or d seem you can maybe take a beauty with your camera and something that Okay, so this is what we want. But we will kind of change a bit. Easy sign because we want Teoh be the default option of video to be full screen video. In order for us to see a larger to use better the vise screen. For that, we will go and switch door I D e and Goater activity made that XML and we will actually believe these Be the orb you right here because we really don't. Well, we really want to use these for now. Okay, So we will believe these for now. Okay? And we will leave only the least view. Okay, so now that we have these, we will create a new activity that will be the one that will play the BDS. For that we go tour package folder, break here. Right Glicken it and click new A DVD and we will say empty activity or something like that . And the activity. Okay. And these activity will be cold. Beat player, for example, Made player. Okay, great. On layout name. We will call it a video player. Bto blade. Your you can see So right now we cover wreckage. Name is thes and search languages Java. Now we can click and finish and the I d will generate activity for us. As you can see, we have these and we don't have We have BZ. These weren't because we have not created yet. The XML file If you go to her money first file right here we have You can find that we have created these new activity, which is just one lying. They will because you have to activities. We have the bead activity or the big player activity, and we also have our main activity. Okay, so for dot we will be thinking if we need to out some extra parameters reversible be the player activity will be the one that will get the video file, and we'll actually output to the screen, you know? So that's the kind of a very important activity right here, and we want to get it right? Of course. Okay, so the BDO Player activity, we will set thes to have ah, landscape orientation. Do you know? So you gonna say screen orientation? It will set it to censor landscape which will detect when it's a landscape. OK? And we will also all of the configuration changes to orientation. So we will know with your orientation changed. Okay? Okay. Okay. And I think that will be it for now. Has empty body said to two sounded. That warning we were just Brizzi for was last year and That's it. As you can see, we have RBD a play here on our main TV tea activity, actually. Okay, now we can go back your video player activity we just created right here. And as you can see, we have a warning. As I told you. So we have to create be layout off the video player. Okay. For that we go. And inside the wrasse folder inside the layout folder we right click Anthes. We go and click on new layout, the research file, and inside here we will We will enter the new name off the XML file, which is be Theo, lay your okay. The root element of these will be linear layout and pressing. OK, and it's created file file already exists. So we have created to file ready Burnley we cab. Oh, these was created by by the i d. E. So we will delete these and do it again. So we'll delete these factors waas previously created by i ve we go and say new layout the research file and create our new BDO layer file. As you can see and you'll change to rid element too lenient layout, Greek and okay as you can see we cover a new media player layout created now. This is said so let me see if I can close the preview. Okay. Great. Now I can that these enemy lined and we have the state much part. We also wanted to have a gravity center in other for eight toe look symmetrical. Okay, in the background of these will be black. Okay, on the orientation is vertical, which is already set. Okay, inside these real greater media view. So here is where the GDP would be created. So be the abuse. The weak will be much for it. The height will be dropped. Continent. Okay, No, the height will be also much part and some wrong here because we want to use the whole the whole space. We have said much bar and, uh, the gravity hubo again. It's not layout. Oh, yeah. Layout gravity center. Okay. The idea of these will be video for you, and that's basically it. Okay, so now we can close this file because I don't think it will be using it anymore. We open our video view activity, and as you can see, it can resolve the symbol. Even though we have created it. So many for doubt. We will clean or rebuilding project to go to build and rebuild projects. And maybe you don't see these. Maybe some of you will see these error, but he will depend. So were revealed in the project and maybe bear. Then these will be fixed. So we wait for it to reveal the project. And it's not working. Realist. So let me see what's going on here. If I click here, maybe there's a typo. So video player main layout. Okay, it says that it'll Reddick's so we will ignore it. Ease, because this is an entrance to the error right here. So we have to ignore it. Ease for now. Okay, so this is the only created me tell and us we will create a couple of global variables right here the 1st 1 of that beam to be the view itself. So we're gonna say private, be Theo view we can view. We can call it my BDO view, as you can see, and we will set this to know. Okay, there we go. And they find the position of the BDS or current position, Senator, private in position and it'll be syrup as they fold. Of course, Now we can create progress dialogue which will enable us to tell the user that we're loading the video. Maybe. OK, so private progress, progress dialogue which is duplicated? I think so. We may not use in the aunties because it depreciated, but for now we will use it may be at the beginning. Then we will replace it with something. You work. Okay? You would need it anyway. Okay. Drug raised a dialogues. They had a type of years dialogue. Okay. And we will have Teoh also create or breath new class, which is BT controller. So you can say private video controller and we'll call these media controls. Oops. Come. Trolls, maybe controls, as you can see. Okay, so now we're gonna create our media player, which will enable us to actually get the action from media controller. Jeez, private media player and player. It was said also these two, of course, then forgets import all of these as you can see and I always have created or global variables. So after with these said the content view dugandzic check. If media controls is equal to know, we will initialize the media controls for doubting going to say media controls. He said to new video controller, and we'll posit contacts, which is beef player dot piece. You can see right there. Ok, so that's our media controls. Now, after these, we will initialize the BDO view. Okay? For Daddy Going to say my bt of you will be set Teoh find view by I d artery. He'd out bbo view, as you can see. And Rick, you're going to say my video view that set are Yeah, set. Keep screen on because we want to keep this green on while we're playing the media said it's true. Okay, great. Now we are about to create brokers dialogue, but we may not need these, you know? So we may not need these brokers dialogue. So So it was deeper cave anyway, so just delete these. Okay, so that's burgers dialogue. We believe it was. Keep that for now, and we will right now opening Try block. So does a dry well bracket. And you were going to say my video bju that said media controller and deposit media controls right here. So we're sat in their front. You mean the controller And also we'll get the the theme Intend value that was passed by the main activity. Okay, okay, okay. Okay. Okay. Okay. So let me see. What can we do? Hear differently Zone Because, hey, string, um, intends info. And it will set thes Teoh get intent that get stream extra and you say bdo um, a DVT intent. So the same. We import previously, so we have to import thes. So we go here and type import. Um, com dot example dot main duty. Was that over the A player that main activity that Oh, off course. It's a static again and forgetting they so important static. And this will be BDO activity intent, as you can see right here. So you go get a string extra, um, right here and we passed video activity intent. As you can see, we have some sort of warning right here. So we have to go and change these valley to string. So it's not a means is a string. So I changed the string and big effectivity intend gonna say BDO, for example, or something like that. Okay. And now we conceded the wording. He's gone, so that's during extra as you can see right there. And now we're gonna, um, get if we have to restore some value or not. Okay, for that, we're gonna access a shirt preference, which is in the way in which we can save stuff or information for later use. Even leave the obvious closed. For that, we're gonna say final shared preferences called Best be. And you go say reference manager reference monitor that get the fold, shared references, as you can see. So get the full trip references, and you're gonna get application context. This way. We access in application wide sheared preferences, which is great. No, we will at the bottom later. That will enable us to continue watching Hebdo that we left previously. OK, even if we closed the APA's, they told you in the previous tutorials. So you're going to say eve intent info that equals, um continue watching, for example, there continue watching their something UK to continue. Okay, just continue watching. Okay? As you can see right here. So I equals continue watching. We will get the the BDO path. We're be watching. Okay. We were watching previously for that. You're going to say, um intending ful or maybe we want to reset thes two SB That gets string. And we have Teoh save it in some way of using the key right here, for example, Saved video, Okay. And default value will be. Of course, no. Okay. And we also have said get the position of the video. So we're gonna set an in future that we'll store the position off the video. So these will be these into the instrument right here. We set up a zey Global Viable said That's why we use these position for so right here. Gonna go and say, um, position illegal to SP that get in in this case because we're gonna eat. Who's that? These will be association as I d and zero as the fold. Okay, so great. That's what we call when we when we click and continue watching by the new video at all we have to do you actually save to save the current pot? You know, for that we're gonna say SP that edit that food string boot string. As you can see and thes, we will be saving the the path wonderful later Be used with the continue washing feature. So we'll just continue watching separately week we were fetching, and now we were saving it. So continue watching and we will pass intent info. Okay, As you can see in the info and we will apply. Okay. Great. Now after D's inside. Still inside to try block, We're going to say ive intent info is no Okay. If the intern info is no, we will basically go back to our activity Or Dad gonna say intent. Intent. New hopes Absorbs so intendant Important intent. New. Okay, new intent right here. Beat play here that thes and we go and back to Main Nativity that class. Okay. And we go safe courses start D v d Move costs intent You can see. Okay, so we started ktvt and here we well on Saturday bto your I Okay, so you're going to say or maybe to be the a path in this case. Urgency. My video view that said video talk and these will be set to, um, intent painful, but you can see of a So right now we have to add the Koch locks it and takes Koch exception e, for example, and inside the cost block. Well, we have never will say, Uh, long that e for error and say we have in the air or air they last year Know what? The air waas B e that Get message. Okay? And we also have to will bring the start trays. He is that friend Start Trace. OK? Not really a masked Davies, but Okay, After the catch block, you will recall request focus. Okay, for that, we're going to say my video view that request focus. Oops, because accuses you can see. Okay. And now we've got two. Said the number bird listener that well prepared to be to be able to play the video. Okay, so we say my video hopes my bdo view that set on prepared lease in there so you can see right here past new media Play your that on property leased. Okay. And inside the ump, looper Mito, we're going to say and play year equals c past body, which is MP. Okay, MP. And if for some reason or a big give you is no, we have to check if the big abuse is no or not. Okay, for doubt, we gonna say, um right here after, So let me see these guys is doing inside the own prepared Mito. So we got to say, Eve, my video, my media view east diferent than no. Are you going to say my beef GOP that seek to position we're restoring are setting for the first time the position? Okay, Heath position is equal to zero. We will start fresh video for Daddy. Gonna say might be viewed that start. Okay, Ailes, we will use the MP, the media player, to start the video, but before dot for safety reasons, we will check if peace that no MP east be friends with that goal. Okay, You say MP, that start. Okay, so the 1st 1 is when the video is in fresh state and 2nd 1 is when the video is just Boston . Were justice starting for the position? We Where in previously? Enough. We did these. We want a full full screen mold, you know? So we will call a Mito that we'll enter the full screen mode for a doubt. They're going to say we called me tailed hide system. You I okay course we don't have that meeting yet, but we will create it just now. Okay, outside. Don't create me. Told will say private void, hide system You I inside these we will create a beauty. This is basically the default way we go into full, full, full screen. Both in all devices. Dicker of you, You're going to say God, window, get window that get the crib. You as you can see right here. And after that, we gonna say the review that set ceased them. U I BC ability. Okay. And we'll go past the capital flocks and see the 1st 1 being you. See, stem system. You I flock full screen. Okay? They're gonna into Oops. What? They just e okay. And then we will enter and or right here that we see what's going on here. Okay? We don't need these here. We want to enter. Or have you, um, ceased them? You I flock hide navigation. Also viewed that. See? Stem you. I so ceased them. If I lay out full screen, okay. Also, we'll pass. View that system. See? Stem you. I flock, um, in marissa sticky, which will hide the bars automatically. Okay. Okay. We could leave this again. Created these for error on the weekend. ALS are so we have flak froze green Wakanosato five navigation. Okay, you I flock fight navigation and layout navigation. So we go view that system, you see. Stem your wife locked inside. Okay, Take care. We are okay. Fly. Lay out. Very navigation. So flag layout, navigation, But you can see. And I think these will be eight for these metal. We have five right here. Maybe want up one more, like layout stable to make sure it's shows. Okay, so we're going to go and say after these wins, um, view, Doug, system system you I layout stable. Okay. Okay. They are stable. The out full screen. Okay. And we will leave that there. So we're calling high system. You I when we need it. So since thes classes kind of long and complex abate take some time. We will continue to do it in the next video. So I see you in the next video. I hope you enjoy it. And don't forget to join the next video by 12. Finishing the Video Player Activity: Hello and welcome to these new 100 development to eternal. This is barred five How to make a beat? Your player application for 100. The previous beauty was started setting up the DVD player A DVT, the Java file. But we didn't finish so in this video will finish it. Okay, so we left these, like hiding the system. You I and we created the high seas, didn't you? I'd mito so for you to remember We are We were working said in all these stuff in order for us to play video inside the only create meat Oh, Okay. So we still have to set some stuff in order for make our video player work perfectly. So with these heights sees did you? I call. We are kind of done with the create me told after these we will override the on safe instance. Me too old for a dog. We go ahead and type Override that is meeting with unable last to save the data. Okay, like the position off the video when the user closes the gap. So on save instance state Okay, and we will pass it. Bondable se in stuns states, as you can see if we opened these me till we have to call the Super Mitos. They say in super that on savings and state savings in the state. Pretty simple. Okay, now we will store the video. We will save the BPO into our shared preferences. Basically are actually saved the instant state. Okay, so you say Eve, my bdo view East the friend, then No, we'll go. Yes. And say, Say, for instance, state that put and And the key will be opposition position and will pass. Um, my video viewed that. Get current position. Okay, so we're getting the current position of the video, and we're passing these and we cannot pass the beauty people want. So my baby, baby that boss. Okay, so now we will override the on the restore. Instant State will get that Bali's. We're going to see a bride public Boyd on Earth door. Instance State, as you can see. Right here you pass. Bomb, bull, save east. Stay as you can see called the Super Mito Super That on restore on restore instance. States saved instant state. Oh, we have a type of here if we get in this instance. Okay, great. Okay. Okay. now, after we call the super meat. So we will get the position we saved previously. For that was said position, which is a global viable. We will be set to save instant State that get in, um position. Okay, great. So we're getting the position right now and we will try to seek to that position, or they're gonna check if m play here. He's different than bowl. We're going to say em play year that seek to possesion. Okay. Ailes, ive if even worked with that approach create a kind of new try was you'll be even my video view east different than a little and say might be give you that seek Teoh position. I think he should work. I'm not that sure, but I think it should work. Okay, now that is when we own restore the instance. State of for activity. Okay, so that's great. Now, when we pause the when we paused the application, the activity in this case, we have to do some stuff too, to go and override, um, for attacked it. Boys on pause. Okay. And aside, his meat will go and say so. We will call the Super Mito last in this case because you want to first all deal d the passing stuff. So if and layer he's be friend than no, we'll go head and say, Heath, my BDO view East different than No. Okay, we'll say so. First event player different. No, we will pause it right away and play your about, boss. Okay, a simple is that. Now, if my BDO butte is different than though, we will save the position. So we are saving the position in two different ways using the savings to state and the only cause maybe one of them doesn't work. So we hope the other words So position will be Get current position, okay. And we will save these by saying reference, monitor that get the full shared references and get application context. Okay. And to edit shirt reference, we have to call the Mito that edit right here. And we want to put into put being okay, And this case will current positions there say position and go see Shit. It's the first week as the string and then earthy into your position and we say apply. Okay, so we're safe in the position right there. Okay, enough thirties we can go. And we also shoot Check when m player is No. So sometimes this happens, you know, And player, we will be No. And we have to check it again. So, Els, if it's if it's knoll than we do else if we'll check my video Butte, he's the friend within. No, we just checked it before, but that was different case, but we can make these Muller, but for now, we'll just leave it there. It's okay. Position equals my video view that get current position okay. And we will pass saying my BD view that pass. Okay? And we will basically do the same. We did previously. That is, to save the position, the shared references. Okay, so just copy, please. Maybe we can cleaning up the code later, but for now, we will pause and copies. Okay, maybe cup. We should call these before pausing. Okay. Okay. So that's great. After dot We can call super on pause and we were there. Now we have the out. We want the up to have full screen capabilities all the time. Not only one we call the highest in the eye. So to enable the optic cough full screen capabilities all the time. Your bride, The on Windows factors change meter. So override, uh, Bob Leak boy on a window. Fuck. Use changed. Okay? And as president will be bullying cast Faulk use okay? And they call the Super Me. Tell super books Super that on Windows focus changed. We pause the house focus parameter here, and we'll say if it has focused. So if past for cues, then hide system you I So these will enable us to have full the screen full time. Okay, great. You know what? If we want to go back to the previous application when the up waas, um when the back baden waas breast. Okay, okay. Rent. So we have to but we don't want to destroy everything you know. So for dot What we will do is we will create the ome bak breast bottle. So we go and say, um, we go and say public, um, public Boyd on a box rest. So make sure you type it correctly on back breast, okay? And now we will kind of show a dialogue that will enable us to to ask the user if it wants to close the up already want to just close, you know, to do not close the half, you know? Okay, for dot We're gonna create a dialog interface. The Uncle Gleason there actually, first this way, because we can do that. So dialogue the law interface, that unlikely lease in there Who called these? The law? Um, I look like Gleason there, and it will set these two new new I look interface, but it's that consulates on click listener, So dialog interface. Um, quickly. Sinner. Okay. Oh, I did it wrong. Sorry. So here it greeted eight on consulate. That's not what we want. We want a bleak listener. So on Fleek Lisa. There. Now, I can go here and say new dialog interface on the least there, and it works as we want. Okay, So inside the on click Me toad were going to say, um ive we want to get which body was great. So if we each equals, um dialog interface that Baden positive. Well, do something. And Els else if pope symptoms. Oops. L Steve, which equals dialog. Interface that button. Negative. Do something else. Okay, so in the first case, if the bottom is positive, we will be asking. The Diallo will be asking Teoh close app or can close bdo basically close up a close? BDO, you know, two different things. One would be bust even big net. Okay, if the positive part in this great we'll just move tasked back. Okay, so you guys hate move. That's two background through which is not truth were not good since it true. So in the negative bottom, we will start the activity and we will show. So we will go back to the activity that shows the videos list on. We'll also tell the activity to show button that will say, continue watching if you want to continue watching these video. Okay, So you're gonna say intent intent equals two new intent. Um, b player that thes, And we will go and launch main activity about class. Okay, But you say intern that food extra. And here we have to put the media activity intent as first parameter. And a second parameter, we'll use, um, the show. Continue watching preferences. So what the's preference are for? Well, basically, these references enable us No. What is the current state and what he's being asked for us. So we will say show. Continue watching. Okay, because that's what we wanted to show. Okay, great. So that's the put extra, um, functionality we're having right here and now we're, I think, almost down with these. Okay, let me see. We carve out of the the positive bottom and negative father, as you can see, but we still are not showing the dialogue. So we have to show the diarrhea off course off course. And we go outside big league lease in there, and we will say, Okay, we first Anthes with semi Colon and here to say alert dialogue dot Feel there and we will call these feel there you want se new alert dialogue that the fielder? Because thes context. Okay, they're going to say, builder, that set message and we'll call groups. It said the message and the measure Real Sandy's they want to exit. So, exit question mark. Okay. And that's ideal. Say said positive. Baden and Boston Baden will be close up close up. And of course, the listener will be dialogue greatly. Sinner, as you can see right here. And we also have certain it's departments of that those so that next line that said negative button. And these will be close video and the same least so dialogue quick listener. And it will show the day looks at that show. And now we're showing Diallo right away. So we have created the dialogue. We shown the dialogue. We show that the full screen view we said some stuff in on pause, we restore it is in the state we saved instance State. We also created on prepared and set all the sensation stuff on the on. Create me tell. And now with all that dawn, we have finished with our feet. Player activity. Okay, so our big play your TV tea is now finished. The Nestea, we have to do Eastern access that activity from our main activity. Okay, so we have to act in the media player activity from our main activity. Okay, so we go to remain activity that Java file right here. And as you can see, we don't need these BDO pew right here so we can delete it because we're creating the beauty of you on its own activity. Okay, So what happens when the least view all sat on click listener thing is clicked. So first of all, we have Teoh to get the path off or, um, off our video in order for us to be able to show the video, you know? Okay, great. So to get the path off the video, we will dio the following. Okay, we have the videos least death in the released view. And now we want Teoh. Um you know, Teoh get the the current video and sent it. So inside the least view on Itim Fleet Leasing there we will ride just that. It will said, um, intent intent equals new intent. Okay, Which you will be, um, contexts, which will be bees. Okay. Okay. These and be layered up glass. Okay. Okay. What's going on here? I cannot resolve Constructor that missy. So new intent context beat player that class. So maybe these here we can use main activity. That thes. Okay, that fix these better. Okay, now we're going to say intend that that with extra. Okay, put extra and will say, read the activity. Be Theo activity intent and we'd sent the current video. They're going to say videos least that get, um position. Okay, so we get into current position June step, they're going to say start, Uh, TVT and we will pass intent, as you can see. So when an item is clicked, these will be called and will be sent this to repeat player that class. Okay, so we will run the up to check if that works or not. Okay, so we're wait for the compilation to end. We are installing day PK. As you can see, I have to be the least. And so have you done half videos? Please download them and they will appear here. If I click on one of them, I can see these open. As you can see, the video is playing. So I'm switching the emulator right here. And since he's a pretty small video, it already ended. But if you press the back button, we say close bdo or close up. And it was a close up and the app is closed, so I will retake the emulator again. Okay, So you can see now we're gonna open to be the player again. As you can see, eats feels he's here playing video, as you can see. So I hope you enjoy the video. And now we're ready to play a video honor video player on and the next BD and we will continue to have features going the code and improve you. You I offer application. Thanks for watching. And they see you in the next one. 13. Improving Video Controls and Saving Video State: hello and welcome to the new under development tutorial. This is part seeks of how to make a bigger player application for Andre and these big You will continue to work and Media player and if eats Boggs and features clean up the code and so on. So if you run the app right now, as you saw in to produce the story of we were actually able to play a BDO Teoh again, make sure your steps to Media's downloaded in the downloads fall. There are to be deals folder or even on the d Seem folder. Right now I'm compiling the application and running on my Amy later. And as you can see, I have to BDO. So the APP have found two videos. As you can see, the first video name is kind of long on in the second line of it. It's not being shown as we want, so we will increase a bit. The height of the sales over Listsview for that will go under the APP folder rest ful there , um, layup folder and the idea that X and mo file we'll open it instead of high in a 50 BP of height. We will increase maybe to 55. We will check if that will work. So now I'm running the app again, compiling it and running again. And I will check if that changed. Makes you look better on the as as you can see. No, I can, um the whole letter. Why? As well as the whole letter P is shown. So that was a quick fix. They just make this look a little bit better. Ondas You can see here help to them before videos. If you don't be just so make sure they are before and if we click on one of them it will show the activity of the video playing just right here. So it's chosen it on the landscape mode. So let me, um, switch the emulator orientations Landscape, As you can see here is what we did. And if you click on the video, the controls we created appears So here is the actual controls we created. Ondas You can see here is the Pavin we used. But for Indies and later, as we have the bottoms outside a screen we don't need at that lab mean right here is help, depending when you're Dubai's you may want to cover or not the spanning. Okay, in this case, I will remove that party because I don't want that to be shown. Okay, so I'll go to the understudy, i e I go Teoh, BDO controller, that job of file and right here the bothering. Um, he's kind of the ride the margin right here. So if I come and these lines with double forwards lash and I run the up again department should be fixed now, so switched to the emulator and wait for damp to be run again. So to avoid searching orientations, I was Greek in one of the videos, and as you can see it now, there's no partner at the end and it showed off the whole width of the device, which is great right now. If you click on play, um, you can stop and play again and it's working great. This first we know. But remember, we also added the bottom right here to close the full screen mouth. But the problem is that the bottom we added is in black. So that's why it's not been shown. So we'll change. Change that bum too wide for data will open their drivable on these exit file is the trouble we created. So we will delete thes file, right? Click delete. And we pressed. Okay. And go on, Drabble, New Vector ass it. And as you can see, here is the the previews I can we created. But this time we will change the color from black to more clear color like white. Okay, so we want the white collar. As you can see, if we choose thes we have it now in white and legal. I will change this to exit. Okay, quickly, go next. And that unfinished. And I will run the up again. Check that That changed to effect on the application. So I switched in the emulator leak on video and they will click on the screen. As you can see, 1/2 here. These bottom Teoh exit from full screen, as you can see it right here and now. If I click on that, then it goes back to the main activity, as you can see, which is great. No. And we also have the option off pressing the back Baden. So let's check the back body functionality right now. Okay? If I open enough And if I show the buttons So here you can see more a larger views, the up. And if I click on the back button right here, curiously dialogue t exceed the up. So we can either close BDO or close up Glicken close video that nothing happened. So we found it every right here. But if we leak and close up, then the up is successfully closed. Okay, so there is an error when we click the clothes BDO button. We will fix that error right now to fix the error. We will go to video beat player, that Java and inside here we will check for D for for the dialogue we create. So when we go on back breast right here and the we wanted Teoh, we actually want to launch the main activity, but we want to send an intense to that activity. Okay, So, to launch the main activity, we have to do this, but we're not starting the activity. So we have to say, um, start activity, start at the de, and we will pass intent. So these was missing. Okay, so right now we're Rondi up again and check if the back bottom works. Okay, so it's Ronnie. Let me see and likely gonna on one of these. And here we have the up. If I present the back Barton, as you can see, and I greet him close BDO then do videos, clothes, and I'm back on the up. But there's still something missing. I can change your orientation now so you can see there's still something missing here. Because when I go back to the op, why they want the up to show the main activity to show is a button that will say, continue playing the previous video, you know? So we want that functionality to be implemented. So to implement that functionality, we will go to remain DVD about Java file, and we will go to the arm, create me, told right here. I mean, after we set the content of you. And what we will do here is we will get be intent that is being sent by the other activity . Okay, So how do we do this? Well, we will create a string that will tells us this state if there is one anyway. Okay, so we go ahead and type final string, um, state or something our activity state. Okay. And we will set these Teoh get intent that, um, get stream extra hoops. Sorry. Get intent. Get string extra. So we're getting the intently send from the previews from the video up in the case, we press the back button. Okay, so get string extra and what we will pass here, ease the video. Um, activity. Intent to specify what kind of stuffers expecting from these Get intent. Metal. Coal. Okay, so we do these and now we will Jack, if he's is not know, first of all, because even created school. But without the bag. But be impressed from the video player activity, then these will be No. So you have to check that. It's not know. So I'm going to say if activity state is the friend than no. So ive activity state is different than no. And we have to also check some females. And, um um, we have Teoh to check if the activities telling us to show the continue watching bottom so her dad lose. Say ive activity state equals, um, continue watching. Okay. And activity state that equals and continue watching. 02 bedroom for these related can create a global viable. But for now, we're gonna go to bit player to see if continue watching. Now we want is not continue watching is actually show. Continue watching. OK, so he's here. Show. Continue watching. So if that's the message we're receiving right here, then we have to act accordingly. Okay, If that is the case, we will have to set the We will have to get the current Um, we have to know if there waas a path. Safed. Okay, To do that, we're going to go and initialize are shared preferences for that. We gonna type final SP. Okay? No, actually, final shared references. Call these SP. It will assign these two references. Manager that get Is that a package monitor? Sorry, it's reference manager that get the full shirt preferences. So we go and call reference monitor, get the folds, church preferences. And here we can take get application contexts. Okay, Great. Now we're gonna get the string data off the bbo. Okay, be the old path, maybe final string BDO path. OK? And it will set thes Teoh um s b that get a string. And here we have to pass the the BDO path we have to get What was the key? We used, uh, home safe, the big apart into shirt preferences. So hearing on pause, we're saving the position. Okay. And on, um, prepare. I think we save the video path. As you can see right here, we're saving DPD a path. Um, by doing saved BDO. Okay, so say safe video is the key that saves the video back. Okay, which is great for us. So here we have saved BDO, and we're not actually saving these, are are we okay, let me let me see Research for saved video. We only have one much, but the thing here is that we have to Teoh. Oh, continue watching. Okay, so So we're saving the continue watching thing. Oh, which is the same of the safe video? Because it's intent info. And here's also intent info. Okay, Okay, okay. Sever saving is continue watching. So we're saving these beady a path. Us. Continue watching. Um Okay, so what we will do here is will get this string and we'll get continue watching. Okay, So get the string instead of saved video. We can We can use safety video, but we're not saving it saved meteorite where we're saving it as continue watching. Right. Okay. Okay. Maybe either will throw an error later, but for now, we will check right here. And you were were safe in these US. Continue watching if I'm not wrong, so continue watching. Okay. Oh, okay. So we're gonna say get string. Come, teen. You watching? Okay. And these will be 70 full to know, and that's it. So we have our new video path. And when we get these, what we will do is we have to show we have to show we continue watching bottom. For that, we have to create that bottom cell for their go to activity main that XML and before the least be, will open an elemental type. Boughton. We've much borrowing height 50 b, for example. Okay. And the I b of these bottom will be calm. Teen, you walked Sheen Baden on the decks of thes Barton will be continue watching. Okay, so we could about can go about to remain Nativity Doc job file. And right here we will be defined at Barden said up a uncle listener for it. So we go and say so. First of all we have to send the continue watching body to that won't be beatable by default. So we're going to say be stability gone. So this is on the XML. We said visibility cones. Okay, when we've done that, we can go back to activity, their main activity, the Java file. And you're going to say, final Baden I have important Barton and these ease come, teen you watching? But this will be set to find beauty. I the artist I d continue watching Barton and will cars with shall be button So continue watching bottom. That said VC ability to be simple. And we'll also said a click listener So continue while she Boughton that set on click lease in their new on click lease in there. And what happens when the user clicks on these? Continue watching bottom. So when the user clicks and these continue watching Barton, we have to create a new intense are gonna say final intent. Well said that these gold intent we'll set thes Teoh new intent, um, made a DVD that these which is the context and we will open to be the player that glass. So this is the intent you're going to say intense hopes in tend that put extra. And if you're gonna define, we'll pass be the activity intent. And we have to pause the continue watching intent. So when we go here, it will say Continue watching. Okay, so you have to pass these. Continue watching. Right here. So I'm gonna say we're asking you to continue watching. Okay? Awesome. Right now we have passed that intent but to have the started activities. So that's a start. Activity DVD will bus intent. You can see. So these what will happen when we click on the's thing right now? What happens again if we go? Okay. Let me see. Oh, great. Let me see. Let's tried run to see if everything works. Fine. So I'm running the up right now. I'm compiling it and running. So it's running. I will open a video, as you can see. Okay, then, Michelle, the it's buttons. If I go back and I press in close bdo I go back here. As you can see here we have our continue watching bottom. If I present that, then it's not ascending. It's not working the way respect because we're not handling the keys correctly. as I told you before. So what? We are Boston here. Ease that. We want to show all of these buttons on Lee when we have something to play. So first of all, we'll say, Okay, we go to remain activity that Java. And here. What we will do is we are getting the BDO path. And if the BDO path is no, we want to return because we can show some That's no. So it's really a pack equals No, we will return. Okay. Okay. That that's that's one thing. But what? We should also have to take in account ease the flow off our application. So the first time this beat a path will indeed be no. So it will be null and we'll return. Okay, so we will return. And then when we pass when we went use urgh leaks on ah, on item. What we're doing here is the following. We're passing the video activity intent. And here So we go to be the a player to see What are we doing wrong? So right now, first we're checking admitted controls wrong are is no. If it is, we initialize all of these. Okay, But here we check if intent info that equals. Continue watching. Okay, If it equals, Continue watching. Then we we get this string saved video, but here we're not saving it at saving BDO. We're saving it as continue watching. So we have to change these from State BDO Teoh. Come team you watching? You know, because here we're saving it as continue watching. So we have to retrieve it as continue watching. So now I will around the after check, even though it wards or not some compiling running out up in the first. Be Theo, I will leak on this. I can really click on these new bottom right here. T exit full screen too. Okay, let me see. And when I click on it, then there's no showing off these right here. So if I go again and they go back with the back, Barton and I present close bdo then to continue watching the show. If I present continue watching than the BDO is again shown and we have fixed thes. But as you saw when we click on these, we we don't see the continue watching Bob. Why? Well, because it continue watching Barton. He's working differently here. So let's recap and get what happens when depressed in here and we start the activity. So we're pressing when we press back, these just happening creating a new intent and say and show. Continue watching. Okay. But when we press on the that bottom, we create it, which is not here, actually. About them be the controller right here. If we check what we do when we click on that bottom, we should do the same. So we're passing returned and we should not pass returned. What we should pass is what the same thing we're browsing down here, which is Choe, Continue watching. Okay, so we have to change. Stop. I will do that just now. So we go right here to our video controller, Dad Jaffa, and is that of passing the return value right here. So, by the way, we don't need these string value off so we can deliver thes It's drink Valley off. You know, we can believe this. We don't need it. And here what? We have 2000 forgot was show. Continue watching. OK, so way have to believe these returns and fast show Continue watching. Okay, so it these three lines. Most look the same. Okay. These three lives most looked the same as thes as these three lines, you know. Okay, so right now I will run the up again and check if that works as we want some compiling. I'm running the up, and as you can see, I will quick one of these right here. And I will speak on these exit full screen thing Now, as you can see, here's the continue watching bottom. If I press on back in, if I press here and back again out. And as you can see, we have fixed the problems, we can't previously. This is for these BDO. I hope you enjoyed it and they see you in next one by 14. Select Video and Rename Video Features: Hello and welcome to these new Andre Development to Tara. These these parts seven on how to make a video player application for Android and improved through. We actually were able to play the video and to exit from that, and it feeds a couple of box in these BDO we will have some features to the up, like the ones off renamed the video, delete the video and even share bbo. Okay, To do that, we will go to our activity main that XML file and after deletes view, we will create Alina layout right here. We say leniently out week. Much parent hate hide will be maybe 50 b. Yeah, and the organization will be set to horizontal. Inside. These layout will create a some button the 1st 1 Well, all of them will have the wheat A zero BP. The height will be much parent, and the weight will be one. Okay, we create, we will create three of these. Okay, So the 1st 1 with me Teoh the lead to the second to share I'm third rename or something like that are maybe the 1st 1 could be renamed, so I d will set to rename re name and the text will be set to rename too. The 2nd 1 will be, um, delete. So I d the elite on the tax will also be set to the elite. Okay. And the 3rd 1 well we share on the text will also be set to share. If I run the up right now, I can see how these looks like on the emulators running the up right now. And as you can see, 1/2 these bottom bar which cast renamed Bleak and Share. But we don't want the bar to be showed as by default. So we want to hide it and show when an item is selected for doubt, we're going to say and on the Lena layout level, we're gonna say the civility will be set to go on in this gaze. If we're on the up again than these, we'll be heated, you know? Okay, it's given, but it's created so we can show it when we want. Okay, great. So right now we're going to go tour main activity dot java file right here, and we will go into our on resume mito right here and after we said Thies on item click lease Inner to the least be Will Also said on item Long click Listener Because along klieg will select um a A file. Right. So we're gonna say lease view that set on itim Long click lease in there New on item along Click lease in there. Okay. And inside here we gonna right the long click logic. Okay, so when we long click and itim we want to select in that sale Okay for that what I will do is I have to create a mito on the adopter that will enable me Teoh, change the selection off these things Because I need a way Teoh to get to change the background may be OK, but as you can see these elements these me tailed also has a view passed right here. So maybe they can use that view to change the background. So I will I will test that right now. I will say view that set back around, caller And I will say I was had that color that, um life Great. Okay. And I will run the app and check if it works. Okay, I am running the app and I will long click on these and as you can see each set and like gray. But the sad thing about this is that the video place steel. So what's being What's happening is that after a long click thes on item, Click Listener is also being called defeat. Is that that we will create a fly outside the only Sumitomo we will call it private bullion , East lung clean as you can see which defaults defaults, of course. And when we went long click meets old is called right here we will set thes flock to true. So we're going to say, is long leak besides to truth? Okay, so there's really talented ways to fix this problem, but this is kind of the one that comes to my mind right now. So we said he's long click set to true and then we have to change thes thing. Teoh false, you know. So let's do capital experiments right here. And you were gonna check Eve. He's long leak. It is said we will maybe change it to false. So changes long click two falls and you will return. Let's see if that words okay, so I will long click on these and As you can see, nothing happens. And now we have fixed the problem. Okay, which is great. Now the problem that as you can see easier they can select Teoh things. That too, um, videos at same time, which is which won't be very useful for us. We want to select only one at a time. So we're gonna do something here. We gotta introduced another fly, and we'll say private outside of the UN resume private bullion. East selected. Okay, So he selected. We will, um, used that viable right here. And what we will do here is that when something is, if something is selective, we will kind of save the position of that selection. So we're going to say private, um, private end selective causation. Okay, positions, hurry. Selected position. Okay. So in weekly, when lunk Leakey's called what we will do here, ease that we will select selective position. So I'm gonna say selected position will be equal to position. Okay? And we also want Teoh, um, check to something if something is selected. Okay? So if you're going to say if he's selective and they will do something and with some females, it's not so if it's you feed selective. So first of all, these on Lung Klay will be said regardless off if it select or not. So we put that before. And now, if easy, selective, We want Teoh, um t own. Select the previous one and select a new one. Okay, so I'm gonna do here. We have to un select the selective position. Okay, Okay. T on selective selective position. What we will dio is we have to ask the adopter to get, um, the butte at a certain position, you know? Okay, which is a way of doing it. But we can also do it a bit differently without worrying too much about that. And the easiest white fixed. This is actually, if it's elective and position, he's We have to check if the user on select this. Let thing before selecting something else. Okay? In order to not make the user thing, he can select more than one element. Okay, So is selected Thies flag. We'll be set in a the else statement right here. So he selected will be sent here so it's selected will be sent here to through and when it is selected, the flag will be cleared so he selected will be set here to false. Okay, Right now you eat. Selected on long leak of on the long bleak. You know, the lung quick is happening on the same view that he selected. Then we will on select it. Okay, other way if we have the position off it. Okay, so right now, first of all, we select befall, so it will bt's else look right here and these cells block. We'll set the east two lines right here. So we'll move them right here and resect selected position to position, and we select that position. Now if it is selected, we will check ive um selected position. He's be friend than position. Then we will return because we don't want to do anything. When we are not selecting this, maybe we have to return falls return False. Okay, but if we are selecting the thing we have to on select eight. So we're gonna say, view that set the background colder. And who said color that white? Okay, now let's see these works. We will run the up right now to see that works or not. Okay, lets see, right here, as you can see I along click here and it's selective If I long click here. Nothing happens if a lung click here again its own selected If Ellen click here it's elected lung Click here. Nothing happened to feel lonely here it's on select. So that's exactly what we want to happen. So right now here we have Teoh. Before we set the long click listener, we will create a butte So final of you it would be Boughton Bar will be set to We have to go to our activity main that XML and other 92 de Lena layouts of I V bought um bottom bar. Okay, bottom bar. Then we go back to meditate dot Java and here in bottom bar will be set to find the like I be artery that bottom bar we end. Linus, have me Colin and great right here. When something is selected, we will show the bottom bars and say bottom bar That said, these ability beautiful. Okay. And when we high that thes and when we also left, we want to hide bottom bars. It would say bottom bar that set visibility to gone. Okay, so let's run the app to check if that works. So running the up I will long click thes and the bar is shown okay. Violently the's nothing happens. But if I long click these again, the bar is gone. Which is exactly what we want to happen. Okay, so far so good. So these is great. And now the Barbie being shown and not if we need it or not, which is awesome. So right now we're gonna define bottoms that we d point previously in the XML, which are the, you know, the delete chair and rename buttons. Because a final Barton um what was the 1st 1 I forgot? Let me see here. So the 1st 1 was renamed, then delete them share. OK, so it's a final bottom for name. Who said to find really? I be art indeed. That renamed. Okay, then I'm gonna go to the next bottom final bottom. Um, elite gonna be fine View by i b Arditti that you eat as you can see and final Baden um chair will be fine the way I d artery the that's share. As you can see now, Blue has had the click leasing therefore renamed for example. We're going to say, Rename that set on click Lease in there because when we say new Uncle Nick Leeson there Okay, so when we click on theory name bottom, we have to do something. OK, we have to rename the file the same with the Taliban. We have to delete the file and the same with share. But we have to share to file. So for the renamed Baden, we will show a dialogue in which we will ask for the new name of the file. To do that, we go on and go or haven't say final Allard die. You love that fielder. It will called these rename dialogue as you can see Go on your line and I will set these two new alert dialogue. That builder and I will pass main activity that these as the context. Okay, so that's your name dialogue. Now we're going to set the text off their name, the title off their name Dialogue. To do that, we're gonna go with, say, renamed dialogue that set title and it was set Easter Rename rename too. Okay, so that is the title of dialogue, which these are renamed. I'll also want to rename to something else. Okay? Then we gotta created at text that will enable lost Teoh. Um, get the new name from the user input Saudis and will use the keyboard. So we call this input. I only said new edit text and we pass or context, which is made activity. That piece. Okay, great. So that's our input. Now we gonna get the rename fat for Dow. They're going to say final string, name path, which is whole path of kind of a new name off these and these will be videos least Dottie yet And we will get the item of the position so it would be selective selected position. Okay, the videos least get select position that the rename Pat. Now we're gonna, um, get that top and shall wait into the at the text so the user can change it. We're going to go ahead and say input that set next, and it will send a text to, But I want one to display um, the cold path. So we're gonna greatest soup string for that. We're gonna say rename path that sub string. Okay. And he would have Teoh get the index. So we're going to say the name Bath that last index off. So we want to define last folder, which is separated by forward slash. So busy, Single quote and forward slash, and we don't want to print the photos large. So we're gonna go ahead and type. He's put plus one. Okay. And there we have the actual top, the actual name we want to change. So right now we're going to save the types of input that set input, input type with type, and we will set these two input type that type glass text, as you can see. Okay, so we wanted to receive tax the same foot. Great. Now we will. We will out of these input fields to be renamed Iowa. For that, we're going to say rename dialogue, bath. Um, said the view and we will pass the input field. So input. Okay, now we have to set the positive and negative Parton's off the renamed Iowa for dollar. Gonna go ahead and say, rename dialogue that set positive Barton and we will call it three name, as you can see right here present comma me lying, and we're going to say new dialog interface that, um bleak lease in there. As you can see, 80 helps, sir. Here we have to end these line with semi colons, as I'm doing. Okay, So inside the on click meters right here, we will create a new strings will be called String s. We will be set to you file, um, rename path to and to say, um gets apartment. So we're getting the part of the actual path current path. We will have a full was large to these, and we will ahve the new name off the file, which will be include that gets next. Oops. Okay. Basically, that's what we're doing here. Input that. Get text. Now, we'll create a new file using these new path we just generated and say file new new file. Real name. So And you file is the name who say new, um, file with the S pop. Okay. Great. Now we have to actually rename. So to do that, we're going to say new off new files clips, new file. We will set thes Teoh rename path, and these will be renamed. Sued the new file. Okay, so that rename to, um, new file, as you can see right here. Okay, that's great. And now we have these new file which was renamed as you can see, and from here would be great if we update the contents off or text adopter for dot We will say fields, field videos least feel videos least and the sad data. OK, so we're going to say after your name was a field videos least and text adopter that said data videos least so these will update the rate I mean the least view with new data. Okay, so let's see, Feed works well. Oh, it's still isn't ready. So I have only said the positive Baden, But I have also to set the negative bottom. So we're gonna say three name dialogue that set negative involvement right here. And we will set seasonality bottom to counsel if we want to counsel these operations. So council coma and new dialogue interphase, Unclean lease in there. Okay, on basic white. Basically what we want to do here If we want to rename, we wouldn't say Basically dialogue that council. Okay, So after these wind these with semi colon and we say renamed dialogue that show as you can see right here now I can run the op the chick If the renamed functionality works as we expect so running the up I will long click on these right here This video I'll click and rename. As you can see half your name to dialogue, I will want to delete these numbers. Okay, at the end, and I will click rename. And as you can see, I have renamed it. But now it is a steel selective. So after I rename it, I have to on select the the item. Okay for that what we will dio is we will sort of get thes and we can do a quick fix on the said date up. Um, we told because every time we said data, we want to clear the whole thing. Okay, so right here we have to say, said the data. But if we want to do it in a different way, we can maybe, um, change the view, are safe the view for later. So apart from saving the position, we will save the view. So private view, it's view with a Capital B. You selected selected view, as you can see right here. And when the long on long click item is called we will set selective you. It's a view right here. So when we selected, here's where we selected and will say selected view. He's equal Teoh view. Okay, so when we end the rename procedure, we can go and say selective view That said background caller who was set to call her that white for some color dead. Why? I will run the up again and check if these works. Okay, Um run India I long click thes and I was Greek and rename I would I will delete the specs ALS word Just leaving videos. That and before Glicken rename Onda as you can see it Waas now on selective which he's great. Okay, now that we have on selected or our videos right here We also have Teoh to set the selected thing to false, you know, because we when we on select these things have to select, said the select thing falls so he selected will be set to falls. Okay, so if we don't everyone did to be exactly as we want. So we want to also set the background color off the item, right? So the background color of the item would be also white so background will be set Teoh number sign and six efs. So these will be kind of more accurate depending on the same. So maybe your team that that you're using is not that our kid with these colors. So here I will test is again. I will long click in these time lapse video and I would weaken rename and I will I believe the sky word right here and click on rename and that you can see nothing he select whatsoever Andi via long Legal it again It is selective in the lung. Klay on selected lunk League of the first elected one click again on Selected Wiki is great . So we have implemented the you rename feature right now in which is great, right? So that's it for these video. In the next video, we will implement the elite and share features. I hope you enjoy it. And I see you in the next one by 15. Share Video and Delete Video Features and Bug Fixes: Hello and welcome to the new Andre Development Tutorial. This is part eight on how to create a BTO player app for Android. In these tutorial, we will implement some new features like the elite feature and also this chair feature. So, Teoh, implement the share feature and the delete feature. We kept the same. We feed with the rename feature. Okay, Okay, so we want to implement the chair feature. Forget it. Gonna say sheer That set on glee police in their new on Nikolay Gleason There, As you can see right here and after we've done this, whether will do is we Will And Abel. This is them to share our video now versions the newer versions of Andre like Meggett newer Have some restrict policies about thes. And we can fix these by ignoring these warnings by saying street mode that bm policy about Fielder. We'll call these field there, and you'll is that Easton you streaked both, um be in policy. That building. Okay, next we're gonna go and say streaked mold. That set bm policy builder that field. Okay, so this actually doesn't need to be called every time the user clicks held to make things more efficient. We will call it before we set the on click listener. Okay, that's right. Now, inside we said the on click listener will create an intent will pause the the actual thing actual how to say we will pass the actual path off the BDO right, So we can shared to be deal with other APS. Okay, great to Bosley path. We have the first get the pot. So the same way we get the pot with the rename procedure, we're gonna get another years since a string, Um, be Theo pot, and these will be set to videos least that get, um and we will pass select position as the index off the realist. So we have our video policies can be said to final. Okay, so now that we have RBD apart, we'll create in your intent for that state final intent Intense. It will set these intense Teoh all signed it to new intent. Um, intense that auction Send, as you can see. Okay. After we've done days, we're going to set the type of intent in these cases. A previously said intend. That's said time on the type of B BDO lower pays video? Um, slash MP four. Okay, so that's the type of big were want to share. So it was said the time of video. Now we're gonna set this dream and the actual your eye off the video. Okay for Daddy going to say intent that could extra okay and fast intend that extra stream , as you can see, and we'll get your eye of the media. So you are. I that, um, from file and inside these were going to say you file okay. And we will pass the big A path, so bbo bath, As you can see, don't forget to end the lion semi colons. Now, we can actually start activity that we share our video. To do that, we're gonna say start activity. They say, um, intends that create juicers of to keep the user different options to choose from, and we'll pass intent. And the the message you want to send this case would be share BDO to. Okay, I think that's good. We end the line with semi colons and now we're ready to run the up. So I'm running, compiling and running, and I will switch to the emulator to check if it works. So right now I'm on the emulator. If I along click on a BDO and I leak on this share, you can see that I have these juicer created for me, for example. I want to share it to maps. Okay, So if I pressed that, I can see that video has been shared and I can even play here. So these how we shared you can share to what's toppings to grandma. Whatever other if you want. So that is the share pdf feature that we just implemented. Now we have to implement the elite feature to so for w gonna set a click listener under delete button. So we go ahead and say, the elite that set on click Lease in their new on click lease in there. As you can see right here And in this case, we want to actually show a dialogue when these bodies he's breast, in which we ask the user. Are you sure you want to delete these video? Okay, so I'm gonna go. It's a final hollered dialogue, that builder and was set these to delete dialogue and the list That beast Teoh, New colored dialogue, that fielder. Okay, let me see? Yeah, it's not a meter. So just that builder in these way, So and what we will pass these will be the context in this case may Nativity that, please. We end the line with semi colons. We go to the next line and continue setting up or dialogue. So we have an a title to the dialogue for not going to say really dialogue that, um set title that title and you'll said It's really so it's the title of the dialogue. Okay, now we gon has had the manage suffer. Dad, they're gonna say elite dialogue That said met set message right here. And we will ask the user. Do you, um do you really once Teoh the lift it? Okay, so we're getting confirmation basically. And now we're gonna get gonna have to set the busted bottom. So you gonna say delete dialogue? That said, posit the baden okay. And posted bottom will say yes. And the next barometer will be the click listeners before data and the line with center columns that forget to do that later. Okay, I'll say new, um, by a lock. Inter phrase that Uncle Gleason there on the A d average in the race. He's going for me. And here we have to delete the file and update the data. So we're going to say new file, um, files lease. Um, let me see videos least actually, videos lease that get selected position. So we're making you file a little, Depress the elite, very deleting these files. So after we delete the file, we have to feel the videos least again. So to update no deferred to be a to be updated servants a field videos Least we call these meat l And then you're gonna say said that the adopter with new new data So you're gonna say decks about through dot Said the data and we will pause videos least Okay, great. Now And that we have thes rate here. We also have Teoh on selected, so But we also have to do that in the share thing. Right? So let me see. So we will check that later, Joe. OK, so we'll check up later. But for now that we have done things and we set the new data, then we're OK. Teoh do this. But now we also have to have be negative bottom to this thing to do that, we're going to say deleted dialogue that set negative bottom. Okay, let me see. Okay. So set. Negative Boughton right here and inside the negative. Barton, who will say no. The user doesn't want to delete it. And we say new, um dialogue interphase, that Dunkley Glee sinner. And when the user clicks and these, we will simply go say bye aloft Council, which is cancelled dialogue on the line with Sami Colin right here. And of course, after these, we have to show the dialogue. Um okay, right here. Going to say the lead dialogue that show. Okay, so now we're showing the dialogue. Now I will run the app to test that everyone works as we want. Let's see. So here is the up and I will long click bees medically. Gonna delete. Not likely gun. Yes, and it's really it, as you can see, which is great. Now if I click thes lung click and these it's not working, so we have never right here. So you have to change the set selected thing. So when we delete something, we have Teoh, um said to not being selective, you know, basically the same. We beat with the rename Bela. So let's see what we did. So you select that should be set to falls on the background color selective. You should be set to wise Basically this the lines you all always be cold so we will call them on the share thing. Great here. And we will also call them on the believed meet with great here and now We were on the app and check if everything works as we want So we're running the up and we have only one video . If I long click thes and click on share then these is shown. As you can see, it's on selected and I can eso that did again. But when we on select it we also have to do something else so quick and share right here. If I go here, then I have to hide the bottom bar again. You know, im not hiding it the night have to hide the bottom bar. So we have to be able to access the bottom bar and said the feasibility of the off the bottom bar Teoh gun, you know? So let's do it right now. In every instance of these. So in rename after we said he select the falls were going to say bottom bar that set BCE ability and these gun. Okay, so that's pretty easy. The same thing when we share going to, say bottom bar that said visibility to gone. Okay, so this is these waas rename These was share. Okay? And when we breast on council, we want to do the same, right? So we want also to do the same right here. So copy these lines. Thes three lines right here, which on select thes thing and said and hide bottom bar. So these three lines air should be called every time we want to select it. So, um here and share your also called and should be also called on elite right here. So after here, we're going to say we have right to first. We have to only Heidi bottom bar. So But I'm barred out said bc militated gone great. And after council, right, he will pays what we copied. So said the background color the cell toe. Why he selected falls and bottom bar visibility. He said to God, which is great. Now I will run the up again to check If everything is working, find and let's see So right here along click and be Dios I would weaken rename No pagan council and it's on selected. So even in when I click on council and click rename And we were named these two videos one and click rename And even there is hype haven t bar. Now we're gonna lung clean it again. And we were gonna share and even go back. It's on selective, which is great, And I will only go These Oakley could be leak and click No, and it's keeping again and on selected. Okay, if I Glicken bees bees played we can stop and pause. We can use thes bond we created to go back. Okay? And we can also press Continue watching to go and continue Watch hearing where we left the BDO. So those are the features we created off our app And now I can also delete these All right here we basically can delete of Greek. Yes, and as you can see ease deleted when we believe thes We want to change the continue watching to be Cuban. Okay, so when we believe these as you can see right here. We want to change the continue watching. Do we have that? I don't think we cap, but we can maybe find it. So find Billy I d are already that. Continue watching Barton. That said, BC ability will be set to God. And basically, that's everything we want to make. And now the up is working great. So that's it for this tutorial. I hope you enjoyed it and they see you in a future tutorial by 16. MUSIC PLAYER! Setting Up Permissions: Hello and welcome to these. New on during the battlements tutorial. These is barred one and how to make a music player for Android. So let's start. We begin by opening under the studio than we will click on Start a new android studio project. Then we'll greek on empty activity. And then on the next button, as the name of these application, we will write Music Player. Okay, so we have the name now men sure that the language you select is Java on the minimum. Maybe I level this time it will select 14. Of course, we can change these later if we need to. We will click on finish and we will wait for the i e to set up our under the studio project . So the under is to your project is now being set up by the hundreds to Theo i e So we will wait for it. And I also want to tell you that I will be running the application on an emulator in the left side off the screen. You can do it in the emulator too, if you want, or you can actually run it on a real android device. So basically what we have to do in these, um, music. Blais, your application. He's actually pretty simple. We need to read the storage off the BIS and find music files and then list them on a least view with its respective adopter. And then we will enable the user to play the those files. OK, great. So the i d house finished loading the project, and the first thing we will do easily will change the layout file. That comes default. So we'll go to the left side. We will open the rest folder den. We will open the layout folder right click on the activity made that XML file and we will quick un delete. We will make sure these both boxes are unchecked. And then we will click in. Okay, so now the file is being deleted. Aziz, you can see and what we will do now we will create a new file, but with a different route. Element for doubt would go again to the layout folder. We will right click on it. Then we will click on a new layout. Researchers file Okay. And as file name, we will write a DVT made so the same name it had previously but unruly element. We will delete the default value and we will type lean era layout. Then they will breast on okay. And we will wait for the i e d generated coat. As you can see, this is cold, baby each and rated In order for us to actually look at the coat, it will click on the text BUE mold right here. And as you can see, we have are linearly out ready to be used. So right now, just a check If everything works, Um okay, I will send the up to the emulator and make sure that everything looks as we want. So basically, these file will enables us to set up how we want the application to look. Okay, so these the xml file, the layout file and the Java file will enable us to set how the application behaves. So right now, the emulator is being initialized right here, so we have to wait a couple of minutes for it to boot happen to run the app. So was it was Stanley, you. We have thes file which enables us to create the user interface of 400 application and we are IV's to the elements off these interface. We can then retreat those elements using their id's from be called, which is the main activity that Java file right here. Okay, so we will wait for any Opteron and we will Jack eat these displaying the right content. Okay, So I will switch to the emulator right here, and we wait. I will wait for it to boot up. As you can see, it says phone is a starting. So these emulator is ruining Reese running android. Um, b every pie on drawing version 9.0, which is eight b I 28. Okay, so it's the latest one as time of recording this video, and as you can see the option to be almost ready. As you can see, there's two brushes and running right here, which is the great all be running, and we cover these updated induces. Okay, let's see now it seems told the application. OK, great. So if we go to the emulator, we can see that we have or up right here, and it's actually working as respect. It's empty because we haven't really out of anything to eat. So right now, it will switch back to the Andre. The studio, I ve And why they wants to do now is to deal with these two bars because we want kind of a cleaner Luca for application. We want it completely. Um, why the screen? Okay, so to hide those two bars, what we will do, it will go under duress, falter then on their values folder, and they will open the styles that XML file. So right here we can customize the actual theme of the application. For a doubt, we won't. We will go inside the style bracket, and we will type item name and they will type, um, window full screen. And we will set these value to through. Okay, so that's one. Is that doing? It's hiding the top bar. Okay. And now what? We're gonna dio ease. We got a if high detail. So going to say no Title window no titled, we Will also said basted True. So with these two lines I just wrote were hiding the both of the two bars we saw in the emulator to check. If it works, I will run the up again and make sure that he looks as we want gate, it's being installed. It's running right now. And as you can see, it's empty. Everything 70 just as they wanted to be. So right now we can go about the under this to the I d. E. And we will close these tiles that XML file. Now we will open the great always creeps file that will enable last to customize and clean up. It's a bit more. We will open the 2nd 1 which is the build that greater file, which is module up. Okay, make sure you open the 2nd 1 that says module up. Okay, so we opened these and this is kind of the an obstruction level in which we set the configuration for applications that this is a simple application. We're just learning we can simplify these pile a lot more. So you can actually, by having a simpler view of it, you can actually understand what's going on. So these lines for testing, we won't be testing it. We're using the unit tester library so we can deliver these line and these brackets thes built type bracket. We done need it, so we don't need it because we're not deploying it and we don't have costs, um, configurations for it. Okay, Now, here on the dependencies, there's a lot of stuff that we don't really need about this. The only one we need is thes one, the APP compact library. So we can delete all the others, but not a bad word. So we will delete all these. And as you can see now, the file is a lot more simple and easier to read. Okay, so what he's saying basically is we have were using a PC 28 to compile the application. The minimum sdk were targeting is 14 and the target is 28. The version called off the obvious one on diversion names. Wine that zero. The all of dependency were using easy outcome with one after we had modified these. We look weak and sink now, here at the top. If you don't find that button, you can also click on these elephants bottom that selecting with the mouse pointer. Okay, so now we can also close these files and to make sure everything works again. I will run the up again and check that it's steel works fine. So I m c I'm installing the up and I'm running and still works. Fine. So let's actually start with the holding off application. Okay, great. So the first thing you will do you work on the layout file off our application. Okay. As I told you, the layout file enables us to create you white elements. You've seen the XML kind of scripting language. Okay, so after we do that, we connected the code from Java. Okay, so let's start working on it. So we will go to activity made that xml file and seems what we want to do is leased the music files air the audio files kind of MP three files. That's ex East on the Beeb ice storage. We will use a least view, will open an element and type at least view on the week off. These elements will be much parent. Behind will be zero B, and the weight will be warned. Okay, we can close thes here to make it more clean to see. And now we will add an I d to the east to these objects. So we're gonna type I d, and we'll call it least view. Okay, so now we have added a least buring here for Apart from least in the, um, the music files. We want Teoh kind of, uh, of course, blading music file and maybe show controls of maybe stop and played the file again. But maybe we can implement that later. So for now, this is the only thing we will act later. We can complete these file so we will switch back Teoh our main activity dot Java, and he will stop. We'll start reading What's going on? So was the fold the i e generates for us. These file announced the own creates Mito in which the only thing it does it's said the constant beauty or XML file. Okay, so we are reading files from the storage from the devices storage and the 100 operating system requires us to ask for permission starting in April 23 or marshmallow and above. Okay, So does for permission. We will go tour manifest file right here. We will open these. As you can see, we have sort of warning. We can ignore doubt like we can and suppress the warning if you want. And we also have here the activity definition The orientation of the activity will be portrait So we got to say screen orientation said that portrait. Okay. And apart from that, we will go with tidy I the application talk and we will open the uses permission element. The 1st 1 will be said Teoh, read external storage. Okay, so we're reading is the external storage rate here, which is the permission we need in order for our application to run. Then whilst we have defined the permission on the android manifest that XML file, we can go to our main activity about Java file and actually start um, initializing everything we want or application to do. Okay, so first of all, we have to be able to check permissions at wrong time. As I told you in my android 23 a BK 23 or marshmallow, we are required. Teoh do just that. So to do that, we will do the following After the on create Mito, we will define the permissions we want to ask for that We're gonna type private static final string strings Capital s so string array. So we will define the permission as an array of strings and we will call this upper case for me actions. Okay, we will set Thesis, remember to And the line with the same My Colin. And he will specify the actual permissions our requires to specify the permissions. We will do the following will type manifest that permission that read external storage. Ok, so this information we we need Okay. It says that field requires eight b I level 16. So to fix these warning we will go to our build cradle file We opened previously The one we have simply fine. And we will change the minimum as the K version from 14 to 16 We will greet him Sink now we will wait for to seeing to be completed. Okay, now we can close this file Go back door May Nativity Java and we can see that the warning has thes appeared, which is awesome. Okay, then we have the find informations. We want we also what? I want to define a request code so we can know which permission we requested and kind of controlled flow off the permission request process. Okay, so do that. We've got to say and created the following horrible private static final eat and we will call this request permissions. And here we have to enable or assign these beans, and it kind of a unique I b doesn't really matter me. Vale told Tell it to be 12345 Actually, any number you want. Okay? And lastly, we have to define a barbell and Bardhyl again and that we will start the permissions. The amount permissions we are requesting this case is just one. We'll call this permission permissions count. Okay. And we will set these 21 Okay, great. So was the folded some devices they permissions are, um I automatically granted, but mothers they're not. So we will check if the permissions are denied by creating the following Mito. We're going to say private Bullen are our permissions b nine. Okay, you will open these me told and we will create a for loop as follows. Gonna say four eat. I equals zero. I less Oops. I less than provision count. Okay. And say I lost loss. We opened before loop on. We write the following logic, so we will check if the permissions are granted or not that we're going to say Eve check cell permission and does the parameter We will pass permissions at I so we have axity the string array of the permissions and we are pointing to the elements. I okay informations at I he's diferente If check cell formations that I is different than bark egx marketing manager package manager that permission granted. So if it's different than permission granted, we will return through which will tell us the permission has been denied. And after we run these four loop and feet casting returned, we will return false, which means permissions are not the night, which means they are granted. As you can see, we have a warning right here in the Czech self permissions line, which says call requires AP Level 23. But we will be calling these Onley in a peer level 23 so we can ignore these by clicking in these warning signs and then on suppress, suppress Lee into new e p. I annotation. We creaking that and these lion, he's Abbott. And now that the wording is gone, So that's it for these, um, these meat sold right here. We will continue right now. And how 30 the user checks our clicks on allow or denied permission. What we have to do is gather the result off that permission if the user allow that already . Night. So to do that, we will do the following. We will override public void on request. Permissions result. Okay. And inside these we have some parameters that are passed. The 1st 1 movie needs. We will pass a request. Cult can say ain't request code. The 2nd 1 will be a string array. Oops, Oops. Oops. What a just deed, I believe Thesis 11. You ready? Begins a public boys on request informations resold inside these we have seen requests. Koth. We also have string are Ray and we have the permissions. We're asking course of provisions and we also have and eatery that we'll return. The results of those permissions have been called it grant results. We will open the meat told and we will call the super Mito. So I'm gonna say super docked on request permissions result and we will pass the same parameters we received. The 1st 1 will be requests, Koth. Then we'll be provisions and then will be grant results. Okay, so great. Now we can, um, make our lives easier by using the previous mito we wrote. We geez are permissions. Deny so we will check it right here. So I'm gonna say e our permissions the knife These means that the user house, the night permission and things that permission is a mosque, the APP Can it work without it? So if the easier denied permission, we want to clear the application data and close the app. We will enable us to keep asking for their permission every time the user opens the up again. So to accomplish that, we will do the following will open to parenthesis. The 1st 1 will ride activity monitor TVT monitor. Okay. And that's why the 1st 1 we will great another parentheses. So the theory to monitor is kind of the Casteen object we're costing into. And these these pregnant the second Frances, we will type B's that get cease them service. Okay. And there's the parameter of these flu costs Back TV tea service. Okay, we go off the these three branches and lean type that clear application user data, and this is basically the line that will clear the data right here. So we have activity monitor, get system service account service. Um, no, it's not account service. Sorry I'm wrong. Is activity service. So let me correct these very quickly. So a TV tea service and we then clear a side Clear application, user data. So again, these wording should be silenced because we're calling only when we shoot. So we're gonna go and say suppress LeAnn's new maybe I annotation and the warning he's gone . In that case, where we will do is we will recreate the activity after death. So the first record ease when the user denies activity and when the user allows, it allows the permission. We want to call the on resume, Ito. Because in that meter, we will do all the initialization, so we just type on resume and we'll leave it there. Okay, so now we have basically created our basic. Me too. Right here. So now let's all variety on resume Mito. Okay, so we're gonna go and say override for a protected boy on a resume. Okay. I decided me to call the super meets out super dot Resume. Okay. And inside here, what we will do is we will check if we have to request or not the permissions. Okay, To do that, we will do the following. We'll go on time Ive Beeld Dogs Version um version that is the K int is greater or equal to revealed that version codes about em, which means marsh mellow. So if these, um, even statement he's through, we also will check if the permissions are denied. So the check the provisions are denied, we will say, And as I am writing right here, So and, um, our permissions 39 So we called the Mito. So if those two conditions are true, we will request for permission to do that. We're gonna type requests permissions, okay. And as the first parameter will pass permissions, which is our rate of permissions and a 2nd 1 will bear the request code. We cheese your request. Permissions horrible. OK, so off thirties, we will retard because we don't want to keep initializing if we don't have the required permissions. Okay, so right now we have our basic kind of up that asked permission. So to check that everything works as we want. We were on the application. Jackie video actually works as expected. So now I'm compiling the up and send the need to the emulator in later rounds, the app and as you can see it appears these dialogue that says allow music player to access photos, media and files on your device and cured user can quick either deny or allow. If the user clicks and deny, then the obvious closed and the application Veda He's cleared. And now if the user it goes again on the music player application, it asks the up again so the user can keep the 19 and keep opening. The op wouldn't see 00 The Andres has a problem here in related has a problem so the user can keep opening the op. Who's because the launcher keeps stumping? So we have a sort of a problem here with the emulator? Let me check now. Okay? Okay, Okay. I will restart the emulator. I hope it will hopefully be fixed. You can say restart. So this is the bottom of the android emulator that I'm running right here. So these emulators often comes. We've box. So right now I'm restarting the application to make sure it works as we want. So we wait for a D for D in later to be restarted. You can see here we have to Google logo and it's being restarted So basically what we need in these tutorial is we set up the under to the project. We simplified the layout file, we simplify the greater build file and we're requesting the permissions in the 100 manifest and also on code. And right now, the glittery Zbakh and I will run the up again typically music player. So it still keeps corruption. Let me see Music player. And now it's working. So now allow music players so you can see it keeps asking until the user allows the permission. So I will click on allow. And as you can see you know, the up Stace opened, which is great. Now we go back to work to where I ve and we continue looking of the code. We can see that the on the honoree Sumi, tell on the return. We have ah awarding right here that says returnees unnecessary as the last time in in a boy Mito. Okay, which is true, but we want that won't be the last, Damon. Because we will keep writing some stuff here. So what we will do? No, he's start initializing the music player for deadly will create a global variable that will be private stock. Not really. Start. It's a private Boolean. He's music. Play your is music. Play your eating. So which means his music player initialized. And it's the fault, of course, that will be set to false. And right here inside the Andre Sumita, we will check for that flock. So we're gonna type Eve negation, ease music player in it. Which means if music Player is not initialized, then we will initialize the music player. So right here, the first thing we will do, he's changed the flock. So as the last statement of these, if, um, Brockett, we will go and say he's music by your eating, and we will separate these two. True. Okay, Awesome. Right. If you remember on the activity made that xml file, we created a least view. So we will access these leads to you right now from the Jabba Koth just is the least you we will do the following We go and say final least view. We'll call it the least view, and we will set these to find beauty. I b r. That I be the least view. Okay, great. So right now we have created a release view So we're accessing these leads being from code . Okay, we cheese. Great. Right. So in the next tutorial, we will learn health set up these least view creating parameter refiles and they'll and everything else we require to make these up working. I hope you enjoy these tutorial. And they see you in the next one by 17. Writing the ListView adapter and adding music files: Hello and welcome to Disney under development Tutorial disease, Part two. How to make a music player application for Android in the previous tutorial initialized the application, set up the permissions and we live the permissions working just fine. These three will continue to work on your application. So right now we go to our Andre Sumi tilled and here in the Czech and we'd rejected the music player is initialized. And the Bruce tutorial. What we did here is we set the least view to the element of or money fast file. Okay, the next thing we will do. I used to actually create an adapter for our at least of you. Okay, so we will go outside the on recent Mito and we will type class. We'll call this glass dext adopter, and you will extend base adopter. Okay, we will open these bracket right here, and we will create the following Mito that will enable lost to set the data off the adopter . First of all, we will create and the release that will contain the data for delving gonna type private least off streams. We'll call these data. It will set these two. Don't forget to import the least library. Let me see least string data and we will set Thies too new are Ray A list. Ok, so we have our data release just created. And now we're gonna set a creative mito that will enable us to set the data that the released we're gonna type void said data. We'll open these meat told right here and what it will do these first, we will clear to previously, uh, data that exist it on the other. Released for double gun. Say data that clear. Okay. Oops. Let me see data that clear. Next. But it will do. Is data date out that or at old? Oh, and what? We have two parties, the new data. So we have to create a new well, parameter inside. Said data me till definitions. Right. You're going to say the least off stream called These data are actually getting We changed the name to make it more readable. M data. Okay. And inside these Oh, what we will do. You will be on old m data. Okay, great. And after we have updated the data set, we were gonna notify that it was updated so we can say notify Data said Changed. Okay, great That Waas are said Data Mitos. Now we will continue writing the next meet old. So the 1st 1 of law bride will be to get Count me toast. Gonna say override. Um, Papa Leak and get count Game will open these and that we will return. That has to be need will be decisive over data set. So I'm going to say they return data that size. Okay, so that's our get counts, Mitos. Next we will, um All right, get item. Ito. So we're gonna say All right, um, public, um objects get item. And this parameter we will get positive position. Okay, So we instead of object here, we will actually change these two string because maybe we need to use these. It would need It's okay. So we will open these me tell the right here and what we will return and all for No, right. Because we don't think we will need it for now. Later. If we need it, we will return what we need. Okay, We have to also ride, get item I d mito. So don't say public long. Um get item i d. The barometer of these will be eat position as well will open thes and once again will return mold because we want be returning anything right here. But we have to overwrite it. Okay, so we kind of return Nala partly so you'll return zero. Okay, great. So that's get item i d. And now we will ride last meter, which is also the most they burned Want, which is to gather view Mito Bob Leak Um have you so we hardly important view library called get view. The parameters of these meat sold would be as follows. The 1st 1 means position the precision off the butte the united would be viewed convert view which is deep. You were getting on the third Eastview Group So view group you will call it parents. Okay, will open these meat, Toth And we have Teoh, Of course. Return debut right here. So first of all, we will check if Cumber new is no in order for us to initialize it. So you got to say Eve calm. Very calm, Bert view He's mall. Where they're gonna go is going to open these racket right here. And if it's know we will do the following, we will get the view and inflate it. But before we do that, we have to actually create that view in code in XML code, actually. So to do that, we will go and open our rest folder here at the left side of the screen. Then the layout folder. We will right click on the layout folder than on view and lay out the reserves file in file name, we will call its item. And as rude element, we will put a text view because we will be displaying text. Right, So make sure you have item and text view and then click in Okay. As you can see, the I d generates these file four hours. We will switch to the text most right here, and we will modify it. Thes beat. OK, so as you can see, the week and high parameters are already set. We also have to set a 90. Do these next few items they're going to say I d maybe my item. Okay. Okay. So now we're gonna set the gravity. We don't want the text appear in the center, so we're going to say gravity will be set to center vertical Okay. Okay. We're gonna kind of change the text size a bit for this case, I think would be to any spear simply that's overthrew text size. So in this be 20 sp Okay, within change that later. Of course, we'll also have a path into the start in their ferocity. Kind of look at it in a more easy way. So you can say probably start are gonna set these 2 16 pp. Okay, So here we have a great warning that tells us that we should also said body left. So we'll do that too. So probably left. We will also said these 2 16 dp Okay, she's great. Now it says that we have also the find Madeleine right dependent end. So we're gonna do that Lobbying having end against Eckstine dp And also bobbing right also 16 dp Gay says you can see the warnings are now gone. Great. And now what we will set the next color too will be to block So gonna go and say next caller and decided to block gonna write number sign followed by six zeros. So make sure they're six zeros and I think we're ready to go now right. So awesome. We will go back to our main activity that Java file. And we will continue to write our get Mito Now that we have created the item the item on the XML file. So even the convert view is no whether you will dio ease come bird view equals two layout inflater Okay, layout inflater that from we open the Frances and we type parents that get context. Okay, I'll tell you these we're gonna press dart it Will Didn't elect intellects next line. Okay, get context dot inflate and we will inflate the layout right here. So be our that layout that item. Okay, it will be the first barometer. The 2nd 1 will be the part of the route. So when a crossbar rent and the third will be attached to route in this case, going fast falls Okay, so we have set a work on Bert beer bible right here in Noble Also said the talk that will enable us to get either later when we want Teoh said the text to debut. So you got to say come birds view that said Doc, and as the top we're going to say new you called her ABS. Abs, Abs, let me see what they did wrong. So you'll be holder. Okay, What's going on here? That me see? New beholder. OK, we don't have the b holder, so we have to create the u holder Kloss. So gonna go outside these get you meet tothe just here. We've got a type class BUE holder and inside these Mitos we're gonna did the following. Oh, we got on creating text view. We'll call this text view Info, for example Can have any name. Really? And is the constructor Meteo, you're gonna save you holder the parameter The 1st 1 would be the only one actually text view. I call it an info and I will open these right here. And I'll said info is equal to M info and that seat for this class. So now we can go back to current convert view said attack line We were previously and now we Connexus debut holder clause be created, as you can see And now all right. Here we will open parenthesis off thirties beholder definition will open princes again to cost in this text view on outside these, we will tie convert view that find view by i d and his i d will type are that I d that m my item. Okay. Okay, so right now that's it. For when the comfort musical. Now what outside these ive Brockett we gonna created Can folder They're gonna say view, holder, call this holder Well said that these will cast these to be holder and it will set these Teoh convert view that get tax. So we're getting the tough we set previously. Okay? And you're gonna get the item that we want to do. Wants to displace you could say final string. Cool. It's item and we're gonna tease data that get the item of the position. Okay, we cheese. Great. Now we have our item or holder. So we have to know, Set the tax for you. So to do that, we're gonna say, Holder, that info that said text said next and you will set the text to the following. So remember what will be stored in our item. Well, when we will be starting, the item will be actually the whole path and file name off our music files. We don't want to show the whole file name. We want to show. I mean with we will want to show the whole path. We just want to show the file name. To do that, we will create a sub string. So to do that, we're going to say I Tim that sob string, okay? And what we'll do here will be I, Tim, that last index off and we will creating single quot forward slash to these means. Just point to the file name. And we will add the want to these because we don't want Teoh bring that forward slash either. So after we did these, we actually have to return the abuse against a return. Come Bert View. And now we cough completed our get view meet oath. And also we have completed our text adopter the adapter that will show the text items toe our application. So we will go back to our on resume me toad right here after we set up the least of you as you can see and what we will do Now we sit up the that through we just created Did that thou they're gonna type final next adopter. We will call these text doctor and we will say view dext adopter. OK, so that's our texted after then we have to create it blazing, which we will start all the videos that we need. So you gonna create videos? Least for down. We will create a global variable as follows Private at least off string. And we will call it, um is not BD is actually music least right, because a music files. So music files least Okay. Okay, so that's the least of the music files now, inside these here after desert after we gonna say music files least and it'll set thes Teoh new our ray list. Okay, Great. Of thirties we have basically set up the least, but we have Teoh feel the least off thes music for deadly will create a meet south before the on resume meet south, and he will call it Private. A private Boyd Feel music least. Okay, so we can call these Mito easily without writing too much code. So we're going to say, First of all, we will clear the videos least gonna the music least they're going to say music files least clear. Okay, Then we will create another um Mito That will be at the music from music files from. So you could say bribe. But Boyd, a music the music files from okay. And the barometer will be a path from which we will have music files. So because it's thier path, Okay, we will open these meat told on inside here we will did following it Will type final boots , final file. Um, remember, team board file and I will call it MIA. Seek the year, our music directory. Okay. And you'll said Thies to new file, dear Fast. Okay, so they had created or a new file. Right now we will check if that if that the five seed certain inside Ive music directory that exists actually even 1000 exceeds we will create it. They even a Gatien music directory exists. We opened these bracket and say music the're that Make em que dear. Okay, there were created this right now. Okay, So if we ive the basically even the directory 1000 exist. It means it is empty. So we cough. We don't have to do anything else so we can return right here to make the code run. Foster, we just type return now, after the sustainment which will run if if the Beatles even the music director existed. We will lease the files off that directory. They're going to say a final, um, file. So final file array and I will call this files. We will set these two videos. Oh, actually, music, beer, that least file. So we're releasing all the files in that directory. Now we will create it for each loop that we'll have only the beautified. Only the music files were, at least So you gonna say for, um, file file? Lower case? Um, Colin files. So these for each and you were going to get a kind of part of the files, you could say final string path will be said Teoh file that. Get absolute pants. Okay, okay. Birth. You haven't sort of forever right here. So found. We require your string and we're getting so so So it's get absolute filed path. Sorry. It was my my bad. So get after absolute path, so get absolute path. Okay, Now we don't have ever And I was gonna say eve about that. And so we've and we will say that MP three, we want to scan an MP three music files. We've got to say music least music files least that as Bath. In other words, ive. The file ends with that MP tree. We will out that file to our music files least. Okay, so these add music's five. From now we go back to war film music least and after re cleared these we will called Bruise Mito, which will be at music files from and what we would call this will be. The following will be String that Value Off and you'll say Environment that get external storage Public directory. Okay, type of new liner. And here's for better readability and what it will cause right here will be environment that directory music. So these means we will search for in the music's directory for music files, which, of course, makes lots of sense. And so that's awesome. But maybe we also have music's on our downloads folder so well, as support for doubt, too. To go say add music files from and say the same string doubt volume off about the off and going to say environment. Okay, environment that get sternal storage directory and environment dot directory downloads. Okay, awesome. So these in new line to and as you can see now we are all the files in these both directories. So we go back to our our own greasy meter. We will call these meetings right here. So let's do that. We go back to the on resume Mito and after we set thes music violist in your released we will call Feel Music list. So what these will do will get all the music files that finds on the main directories we specified. And we will, and we'll add them to the, um, to theme music files list. OK, great. So right now, the week of the data, we have the adopter and the least be we just have to set them toward together to First of all, we're going to say, next adopter, that set data and it's parameter Ruth pass music files list. Okay. And then we will said least view that said adopter and will pass text adapter. Okay, Which east? Of course. Awesome. So now, in order for us to check that everything is working as suspected, I will run the application and send it to the emulator to see if the files are being displayed or not. So that TV has been launched as you can see there's nothing here, but that's because I don't have music files in these emulator. So let me download them really quickly from the Internet. So let me check if we have Internet access. Actually, do we have? I think I just started it off, so yeah, it's connected now, which is great. So right here I will tie download music. No copyrights. Okay, download music now. Incorporate. Okay, let me see if I can find site you, which we Condell that with music without cooperates. As you can see here, we have thes file these this website. Okay, And here he will quicken free download. And Jackie, that works or not, Bradley have to donate to that. All of these. Um okay, so I want to use thes side Burnley Elia's A mother warned relative three music, so it's going to decide. So have you If you do this, police make sure you are, um, you have some music files in your in your phone, so download these click on download, and apparently it's being downloaded right here. You can see it's called Ben Sound summered of MP three. Okay, so if I go and close old my ops and I will open the music player up again. As you can see, here we have the file Russians downloaded, which is been sound summer that MP three. So these means the app is working. But as you can see, um, the size of these text view is Berries. Mall. We wanted to be a lot larger. So you gonna change that in the coat to go to the Andres Todo e will go to the item that XML file and here in height instead of much parent, we will set it to maybe 50 dp, which is larger. So then I will run it and check if the text sales are actually larger. So now, as you can see the cell itself, he's a lot larger, which is awesome. Okay, so right now I will go back to your main TV t dot Java and continue said in thes application in order for us to be ready to use it. Okay, we want Teoh out the following functionality. So we have all imagine we have tens or even hundreds of music files right here. We can scroll into, and when we click on one of them, we want the music to start playing, right? So do the following. So first of all, we have to detect when the user clicks and item. So to do that, we're gonna say least view that set on, um, on item bleakly sinner New on item. Bleak lease in there, as you can see. And inside these Mitos, we will, um we will get the file or bath file, and we will play it. So move to get the file path, we can say final string. Um, you seek, um, music file. God, and you will be said Teoh data is the data or maybe music file list that get Ossetian. Great. So now we have the position off the file we want to get. Now we have to actually, Blake the already file for another well created following Mito. So you going to say private Private Boyd? Um, lay music. Okay, so going to say play music file and we will passed a string, um path. Okay, inside these we will do. The following will create a media player. So gonna type media play your who called it m p equals to view Media player. As you can see right here okay. And they're going to open a try block right here and inside these try block. We will do the following. We will dio um m b that set data source, and you will set thes Teoh file name are actually path. Is that okay? Let me see. Okay. Apparently took a after D's will go and say, mp dot prepare. And after Dad, you could say MP got start So we start playing the music. And, of course, after the travel have to catch the exceptions. You could say Gotsche exception e and we can ignore it. We can bring the stock traces consent e that bring stock trace. So now we have our blame Music file Mito the Red He ready to be used. Okay, so we go back to win on the on item click leasing the right here we can pass these path this music five path toward playing music file detailed and the music should start playing so even, say, play music file Does music filed path and apparently the music The music's should start playing. Okay, let's run the app to check if the Muser blaze or don't. Okay, so I'm installing it as you can see it's here and I will click on these file and they know if you can hear it. But it's being played right now. I will kind of get the microphone closer to the to the speaker. So the music file, he's actually working. He's actually being played, has to be wanted off course. There's just a lot to do because we cannot really stop it yet. We can see how we can't see the Sikh bar in all of that. So we have t also get take care of all of that, even the following tutorial. So disease, Fergie's tutorial. I hope you enjoyed it and I see you in the next one by 18. Playing Music And Adding The Seek Bar: Hello and welcome to these new 100 Development to title. This is par three. How to make a music player for hundreds. It used to Turtle. We said the least views on the data on the least View this through out the Sikh bar that will enable us to change the part of the song we want to play. So let's run the out to check that everything people keeps working. Fine. So I'm running up, as you can see, a have one music pile. So before continuing these dictatorial make sure you have at least one music filed in the doubt folder or in the music folder. Okay? Otherwise, those files want to be a detective, but by our music player. Okay, so now that we have thes and even Glicken bees, it starts playing the music file. Okay, great. So I will actually closed the application to stop the playbook. Okay, so right now I'm speaking to the Andres to the I d. E. And what I will do now is I will go to my activity main that XML file and after deletes view, I will create a new element which will be a Sikh bar. Okay, the width of these element will be much borrowing on the height will be robbed Content. I will have a night be to these elements which are cold Seek bar Okay. And I will also said the BCE ability to these element to gone as default so we can show these seek bar only when we're playing a song. Okay, back on the activity on the main activity That job of file we'll go Teoh be on item Greek me told inside the said item click Listener So we gotta see after we blade music file kind of we will show what we create it. So before we set the click Lisa, there we will be fine Our seek bar for that little tied final seek bar and they will call it seek bar. And we'll set these to find beauty I d art that i d that seek bar. Oops. Seek bar. So maybe have a in spelling there on the XML file. Salemme, fix it. So seek bar. Okay, You know it's fixed. Okay, Awesome. So now I am accessing my seek bar from the from my main activity file. Okay with cheese. Awesome. Now what? We have to do is they'll have Teoh to show the Sikh bar when I blade e song. Okay, so right here after I call the blame music file, I'll say, seek bar that set set the BC ability. And I will said these two peaceable a case. I will run the application to check if he's is working as we want. So now I'm running it and I will click Um, my on my music file. Ondas you can see I have the Sikh bar at the bottom, which is steel doesn't control the music flow. Okay, but we will fix that really soon. Okay, Awesome. So let me close the ab again. T stop the playback of the song. Okay, great. So now that we have or seek bar, we want to use that seek bar to actually manipulate the song as we want. So how can we do that? Well, we have Teoh get the the length off the off the off the music file. Right. So you have to get the length off the music file. And after we get the length, we can know how long our our music file east. Okay, So to get the length when we called Play Music file. We will return the duration off the music so it will return a need instead of returning a boy here. It will return and ain't. And as een I will return the size off the off the media player. So gun say MP actually return and be that, um, get duration. Okay, so gets duration. I return saturation as a name teacher. Okay. No, I will go on the Sikh bar right here before he said to see Barbara stability the truth. Because a final end, it's a song. Duration. And I will set that song duration to blame file, music, file, path. So I get the duration off the music file when I called that meeting. So after we do this, what we have to do is actually, um, set the kind of fall sighs to the Sikh bar. So how can we did that? Well, let me think so. We cover ready, are seek bar, and to do that, we have Teoh said it kind of the maximum size, which, of course, is the tongue duration. Right. So you're gonna say seek bar That said box said the marks and wound bossed song duration. Okay, which is great. Okay, Awesome. So now we have set the maximum off our seek bar. But then what we have to do He's actually set the kind of know when the Sikh bar when the music continues playing so I can update Thesiger bar. So after really find seek bar right here we will do the following It will say seek bar that set on a Sikh bar change release in there and new a new seek bar. Okay, on seek bar change at least in there, as you can see, so make sure have the same. And here d I t, um kind of implement that sell Mitos for us. So right now we have the 1st 1 is on progress changed So we now have the broad risk change of the Sikh bar. So it gives me the user change the progress of the Sikh bar when the user changes the the progress from the Sikh bar we have Teoh um go and tell that to our media player Okay, so how can I cant care? We did this Well, basically we have to access our many a player. Okay? Are actually we should not call it from here, but from on stop tracking touch. So here is where the user stops Watch in D C. Bar. Okay. So to access the media player, we will have to make these media player right here a global barbell. So we will make it the global variable by saying private media player MP, as you can see, and here inside a music file, we deleting me to play your object. Just leave em. P equals new media player. Okay, which is awesome. So right now we cover media player accessible from any class for many meat tothe and right here on a stop tracking thought, I have to change the current state of the media players. You could say MP that seek to and I will seek Teoh, um, to the progress off the bar. Okay, so the progress off the bar will be done. Um, we can We should get the brothers off the bar from the own progress changed meeting. Okay. Okay. So right here, we gonna have said these two end, um, and progress, for example, or kind of song song progress. Okay. And who we'll leave it there and here When the aumf Rocker's changed. He's cold. What it will do here will be, um Let me see. Bra dress actually sunk. Progress equals Teoh progress. So we have no or a new progress right here and on stuff tracking Dodge Here in these Mita, we will seek the song two song progress. Okay, so right now I will Rondi up the case shown to check if it works. So police run it. Do as well. So I will click on the on the celebrate here, and as you can see, a have the bar right here. We keys is still not updated. But if I change the bar, the song also changes. Which is of course, awesome. Okay, which is great, right? So it's working too cold. We wrote these actually working, which is awesome. Okay, so right now, did we cough the ability to change the bra? CRA's what we also wants to do. He's, um, actually change the bra. Cra's as we as the song is being played. Right. Okay, so we want to change the bra, Chris as the song he's being blade. So how can we do this? So we can kind of ah, maybe up the the Sikh bar one second later. That's one approach. Another approach would maybe, um, create a kind of me told that will set the brothers of the Sikh bar to the current position off the media player. Okay. Okay. UK, UK. So we want to update maybe, um, I don't know. Maybe every second there's something. Are there some things done? Yeah, I think I think some that that would be what we want. Okay. Okay. Okay. Let's see. So I think that's what we will do. Yeah. So we want to update the Sikh bar. Okay, So what we want to do is maybe create a new draft that we'll update the Sikh bar. Will that be enough? Well, kind of, actually. Okay, so inside the on resuming Mito, we will do the following. Okay, let me see. So inside the armory, Sumita, we cover seek bar right here, and we want to set the progress as we kind of in this. So it will create a mito outside outside the honor. Sumita, we will call it Private Boyd update song progress. Okay. These Mita will be called every time. We, um we actually we blade a new song Okay, So when we play a new song, which is right here we want apart from set in the visible Dita peaceable, we want to update the Sikh bar. So we're gonna call update song progress. Okay. And right here, what we will do ease. We have to, um no. The progress is kind of the the size, the duration of the off the thing and increased out maybe one second every second for some . Okay, so how do we do this? So when we call updates on some songs bra Chris, you have to oxygen seek bar from outside this. So maybe we can create a kind of, ah, local mito. Okay, so let's see if we can do that. So instead of calling the update sung bra, CRA's trying to did everything locally. So I got to say, um, missy, end position are actually song. Song. Position will set these 20 Oops. So have sunk positions. Has zero, as you can see, Then it will said while sung song position while some position, he's less than song duration. We will up they the the kind of Ah, the soft position. Right. So well did the following it will do. Sunk position sung position the last class. Okay. And here we will have to go and say, seek bar that set position or seek to, um set position. Maybe said position said we'll see you. No, no, no. Something is wrong here. Um, you have to update the Sikh bar. So how can up? Can we have they seek, borrow? Let me see. Uh, okay. Okay. Okay. Okay. Let me see. How can we update the Sikh bar? Kind of set progress seconds a set progress. And they will said these two Song Recesion, Of course, if Iran these that as it is, that these will complete the wild Lupin lesson Second, because we're not waiting. So here we have to wait for second. Right? So we're gonna and all of that. All of these should be wrong inside a draft. So what does a draft means Will basically a draft east the ability of a computer to run coath in a horrible fashion? So one thread will kind of be the you I draft, which is running everything kind of riel time. But we don't want to run everything in the u I dread because we will block you're driving. We will cause the application to stop. Okay, so of course we don't want that. Is that we want to create a background threat. Right. Okay. So we will create a background trans right here, too. Great. A background traffic. We're going to say new threat. Okay, you drag. We called the tread me tell we open and brackets um and they will say public Boyd Ron, we call their own, meets out the open markets. And inside these tread, we will put all of these. We're we wrote previously, so make sure you copy what you have to, and we paste it here. OK, so we moved the coat inside the dress, so we have to dread right here and here. We have to say that start. So we're starting the track, as you can see. So the draft, we will start and change the progress off the song position. But since you're kind of we're enough any more on the on the back ground thread what we have to do east, you have a way in which we can access the back ground threat. Okay, so how can we access? Actually, the background threatened, actually the you I trap. So how can we access it? Well, so first we have to remember that we will be calling these on a track that it's running in the background and we cannot change May change to the you I if you're on the background trap. So when we said these progress, we have to be running on the you. I try to do that, we will type Ron on you. I trad new Ron Nable, okay? And we'll put the seat bar that said progress song position inside these Ron bracket right here, as you can see. And he says these horrible is axes within in their class needs to be declared final, which we don't want because we want to change it. So what we have to do is to make the sunk position a global variable. So we're gonna right? That's some position. Eat barbell outside. The only Sumitomo we're gonna go outside the honor to meet and say private end, um, song position was dead. I forgot the name. Sorry. Let me check in south position. Yeah. So song besiege position. Okay, so now we have our global barbell, which can be accessed and As you can see, the warning or error is gone. So we said to the bra grams right here. Okay. So first it would be said 20 Then we have to sleep too. Right here. We have to sleep. Before we increase the self position, we're going to say threat a threat that sleep for 1000 milliseconds. 1000 milliseconds, which is a second. You're tells us and we have to catch these exception. And we did that and that you can see, we now have basically our drab, which is kind of complex logic. So make sure you got old brackets, right? Okay. So I will run the app now to check the Sikh parties updated as we go. So I'm installing. I'm running the up. I will click on the on the visit file. On that, you can see the bottom bar is shown, but the progress It's not being updated. Or is it? Let me see. I don't think it's being updated. Its sudden movement right? Or is it moving now? It's not moving. Why? It's not moving. Well, I think I kind of know the answer. Produce. Okay. Okay. Okay. So maybe Oh, I think this is also, um, a specified in milliseconds. So instead of increasing Juan, we have to increase 1000. Okay, so let's see if that fixes the problem. So the increased 1000 to basically say glass equals 1000. Okay. And I will run it again. And as you can see now, the seat bar is actually moving one second every second, which is what we told it to do. So awesome. So far, so good. So we're now are playing. The music on the Sikh bar is being updated as the music is playing, which, of course, East. Awesome. OK, but now something useful that would be very useful for us would be to Now, where is the current position? So we when you want to add a text beer on top of this and that text view, we'll also be updated due to say, Well, the current petition is one second, two seconds and so one. So let's do it Right. Awesome. So let's do it. So let's go to our android. Studio e. And who will go to our activity made that XML file right here. Andi, before the Sikh bar, we will create a linear layout. So in type leaner, lay out. The week will be much borrowing behind will be robbed continent. Okay, the orientation will be horizontal end. We want to add 8 92 right, but not really. Okay, let's continue with this. So inside the elite near layout we will have to define it to tax views. One for the current, um, current state of the music in 1 40 duration of the music. So it goes a text view. The wheat will be wrapped continent behind will also be robbed content. The i B will be current position. Okay. And we will create, um another I d. Right here. Another text be so text view, wheat wrap, constant high drop content and the i d will be song duration. Okay, So if I go into the previous to check how these will look in in the application so we can see that ive a click on these project right here, it's not shown. He's shown the bear legal here and the same with these one. So in order for us to see what's going on, we will set the wheat Teoh Well said that would do 50 BP, maybe so if I said the with 2 50 dp of these Guan great here and they have the other starting right here. It let me check. Okay, Maybe we have Teoh. Maybe we'll set some text to see what's going on. So hello. Just test. Okay? It's And as you can see, the hello appears right here. I know if you can see it, but it's a pretty right here. And what we want to dio east. You? Of course, leave that. There were just kind of working. Okay? Okay. And I will want Teoh also put these other text view of the on the other side so you can take next hello again and that you can see it's here. But I wanted to be moved to the ends of these. Can I do that? Well, maybe. Yes. So it doesn't said gravity. Um, right, maybe. No, it's not working, So maybe let layout Roberti. We have to layer with gravity, So let me see. Andre Layout Gravity. Um right. Still not working, but I think I know how to fix it. So instead of the week 50 dp When we will do is with zero BP on the weight will be set to one. And what it will do is as you can see now, these thing occupies all these position on the other advice. Kind of the the rest, you know? So it's kind of a quick fix. Okay, So we can believe these. Hello, sir. Right here. Because those were just to test this. Okay, So we can also I believe these gravity, right? Because we don't really need it. Okay, so we are now have worked too, to text. He's one for a current position and one for song Curation. And of course, we will set them on coat. So here, before we set the unclean lease in there, we will set the the text view. So gonna say final next to you. Um Sung position next view. Well said, find, find. Really I d art 80. That song duration opens. No, no, no, no. Is that some duration? Is song current positions of current position? Okay, okay. Okay. Let's leave this cell instead of some duration. This is current position, okay? And then I'm gonna create another text view final thanks to you Sung operation. Thanks View. It will send these two fine view find Billy I B r Did. I did that song duration. Okay, so now we have those, too. Next abuse, which is awesome. Okay, great. Right now what? We will do East Teoh also update them when we said the burgers off the seat bar. So, actually, only the one has to be update updated inside these. Look, so you can say song position, text view that said next. And you said Texas String that. Baal, you off song position. Okay, we have These will be kind of updated every second, but we also want to update the other one right here. So we're gonna say sunk duration, text view. That said text. Um, string that value that volume off song duration. Okay, Looks looks great. So let's Ron and try to see if it's working or not. So let's switch to the emulator. I will bleak on these music file. And as you can see, we have the duration being update right here. Of course it is in milliseconds, so we have to change that. But so far it's working. Great. So this means we're in 2nd 15 16 off 217 merely seconds, which is kind of three minutes live with more than three minutes. 3.5 minutes. Okay, so he will reform it. These to show actually what we want. Okay, Sell than me. Closed the up to stop the music playbook. Let's switch the understood the i d. E. And right here. What we will do is we will set the value of some position divided by 1000. Okay, to well divided by 1000. And we will do the same with song duration. We will also divided by 1000. So let's run it again and check. No, no, no. I did it wrong. It's not here. Sorry. It's not in set marks and seek Park is right here on this song. Duration text be. We're gonna say song duration divided by bye bye bye bye. 1000. Ok, great. Now we're installing these and you'll click on it again. And that begins. You have 1234 off 200 seconds. So we also wants to change these runs from these two minutes and seconds. Okay, let's do that now. Okay. Lets see Transformed up thing to meet its end seconds. So the song duration right here will have to be transformed. Two minutes and seconds. So how can we have a transformative minutes? Eight seconds. So we first they bite by 1000 right? Which is okay, right? But we cannot actually do somethin else here. It's safe to the by two times instead to increase me one Towson. We can simplify these a lot by dividing it in the circus. So when we get the song duration there, we will be divided well divided by 1000. Okay, so we don't have to divided again here. We don't have to divide it it again here and more. Most importantly, we don't have to increase 1000. Leagues have increased just one. So after doing these kind of quick fix, let's see if it's steel works of thirties called change. So that's run it again. And as you can see, it's still working without being divided by by 1 1000 every time. Please, of course. Awesome. Okay, but now we still have to to change these things right here. So we have Teoh four month, um, these song duration so we can divided by 60. So I said so. Alteration divided by 60 which are the mean, it's OK. Great. So we have the minutes, then we will. They call him, as you can see right here, and then we will add the seconds. So we're going to say also, um, string that value off and we will set the reminder of that division. So I'm going to say Sung Dre, Shirin module is 60. Okay, okay. Let's see if these works now. So let's run it. Injecting the minutes and seconds are probably four minutes, so I will click on the music file. And as you can see, we have three minutes and 37 seconds, which is awesome. So that's it for these BDO. I hope you enjoy it. I see you in the next one by 19. Showing Play Back Progress and Writing Pause Feature: Hello and welcome to these new Andre Development tutorial. This is part for how to make a music player application for 100. And Bruce Tutorial. We learn how Teoh actually bladed music way said the Sikh bar. We said the seat bar to be updated. So let's run the app to check. Everything keeps working as respect. So if we see So we have here the AB and here is or music file. If I click on it, then the music started playing. And here we have the seconds kind of the current position of the music playback and the whole size of it, which is awesome. Okay, As you can see these, we need some space before, um, these things raped here. So we will at that. And also after these words. Okay, So I will stop the music playback my clothes in the app and I will switch to the hundreds to the I e. And I will go to Activity Main about XML and said here on the current position text view, we will set probably ing start. We will send it to 16 the P gate and we will also said Pauline um left. They're 16 they be okay and we will do the same with the other Dexb. Use a gun. Say Parveen and Teoh, 16 BP and also Bob being right. 2 16 the P. Now, let's run the application again to check if these works or note. Okay, let's play it. And as you can see, you know, we have a space before these number, which looks great. And we have also space after these duration. Now, if you will have another reason we have to fix. So let's scroll beat more. So you can see when we click on a different position, the position goes back to the previous one. Okay, so you have to fix that. Of course. Okay, so we will go to work. Oops, I blocked the device. Sorry. So we will go to the main activity that Java file. And when we increased thes song position, what we have to set is the secret bar to so the Sikh Bar is set the progress. Okay. And we also helped two sad for the some precision brokers when we move the Sikh bar. So to do that, we will go to the Sikh bar on the stop tracking touch As you can see, apart from seeking these Braugher's we will go and set the global variable, which is called song position. So said, um sung position or sunk Progress? No, some precision will be set to song Progress Equal sung progress So now let's run the up again to Seve Seeking works better. So he's stolen the up clicking on the audio file And to recap if I scroll it, it goes and stays where I scrolled weeks, Of course. Awesome. But the problem is, you may noticed right here we're not showing these seconds in the proper form. We now need to chill them as minutes call in seconds. So we have to fix them too. Okay, that speaks it. So we go back to write, understood I d e. And where we display the kind of a current thing right here. We have to do basically the same when that we did on the set duration decks be on song duration text. Be so right here. When we set these, we will do the following. So gonna say a string value off some position divided by 60. So that's the minutes. And to say exactly the same in the previously blast. Two dots. Okay, call it okay. And let's put let's go to next line for readability. Going to say string that volume off. Well said song position. This is Yeah. Song position March Elice 60. Okay, it looks right. So now let's run the app to check if it works or not. So we have something here. It is me seeing let me see. Plus said next we have there is a glass eye in meeting right here. Plus Okay, let's run it again. So here it keeps in case of warning. It is not that very important. Okay, so we will ignore it. So if we click on the South file, But it can see we have the current size zero minutes, seven seconds. If we increase the bar, we have 57 58 59 1 minutes, zero seconds. And so one okay. And e d is great. It's working. Great. So let's see what happens when the music ends. Finish played. So let's wait for the music teacher to end. Okay, so he ends. But apparently the music itself doesn't stop, so it's kind of fixed up to So why the music is not stopping. OK, ok, OK, OK, so let's see, Maybe the duration is not the correct one. So with returned an integer, we say get duration. Okay. And we get it right here on the music filed path. Okay. Said marks. We said the maximum sighs. And when we increase the Sikh bar, we're increasingly correctly too. So let me see what's going on here. Okay? Okay. Okay. Okay. Maybe this is not being around it correctly. Uh huh. So what, we have to be here? He's maybe return asserted for uncertified, double or other data type. That is not an integer. Hmm. Maybe, but I don't think so. Okay. Okay. So let's run the music again. The problem. Oh, I know why the problem is, I think I think the problem with these is that the music is being played again, right? So the music is being played enough. You can hear it, but you can also doesn't your device. And when these stuff ends, the music is still playing. Okay, Okay. Okay. So something these kind of wrong here. So maybe we should stop the music playing when the when he's completed. Right? Because it's kind of in a loop. Right? Okay, So to do this, we'll do the following. So when thes while loop ends right here, right here. Actually, when these wild bands, we're gonna set MP that, um maybe pass MP that pause. Would that be enough? Okay, let's let's go again and try to see if the's pause thing works. So let's go here. That's kind of seek to the near end of this, okay? And see ive where we if the's crashes first? Because we're not calling from the trend, and it has to be called from it. As you can see now, it's working. The music was cost. And when we go back, we're not playing it again because we need a resume pause bottom. So we need to create a recent cause body, maybe rate here. So let's create that Bob. So we will go to her a TV tomato XML file and between these two texts filed a little creative bob. Okay, You gonna say, um, Bob and we'll set the wheat to zero. The p Okay, the the high Teoh, um, behind will be wrapped continence. Okay, The way we will also be one. Okay, but maybe we have to change the weight of the other thing a little bit. Okay, Okay. Okay. Let me see. So we cover different, Um, problem right here. How can we fix this? Well, you have to change the weight, so I will give the same way to all of them. So the week off, the the last text you will be zero. The fee on the weight will be one. So now all of them have kind of the same size. Okay, But here, a one. The gravity of these things to be said to gravity Teoh end maybe of that work. Okay, hopefully. So let's see that even works so that that's if these bottom will be past. So that will be the pause button passing the re soon. Barton. So this will be a false positive on the i d. We said the i d the i d to pass Bob. So we go about two remaining tv dot java file and before Italy's abuse had the lease and they're going to say final bottom. Um, forget important bottom. There's a pause. Barton, which is possibly soon bottom, actually. So said find Billy I d r. Did I d that tosspot. Okay? And okay, let me see. So we have these bottom right here, and we have said the fleet leasing it. Right? So you could say pause, Baden, about Seth on glee. Cleese in there new on Glee. Gleason There, inside these we're gonna when we click a false bottom Well said, be that plus okay, but we have to have I kind of a kind of, um a flak. So we're going to say private as global barbell gets a private bullion East song playing we just default will be false. And now inside the east pause bottom. We have to check that flack to know why we have to do so. Say, Eve. Oops. If the song playing, we will MP posit. Okay, so we're gonna say even some playing MP posit, and I'm going to say possible that set text, um, we're gonna set the text to you play so play in past. Otherwise, if the song is not playing, we're going to say MP the resumed that we have that resume. No MP dogs play or MP dot Start. Okay, we will then later fix thes. Okay, so we have MP that start it was said pause bottom That set text and will set the text to boss. You can see after these Eva statement we have two for each. The flock to sleep, the flocks They're gonna say East, it's some playing equals two negation. He's song play. So if it was true, it becomes false. And if it was false, it becomes through. Okay, now we're gonna run the application to see if these works says we want okay, installing and running it. And as you can see, we have the shown even we don't want to. But well, in order firm for a moment and it will click on the on the music file. And and that was it is good to go. Played in the fight legal false than the music stops. And when in Cleveland, blade resumes. But the Sikh bar is not stopped. So we have to also stop the Sikh bar. So let me see. Let me stop also the Sikh bar. So let me see. Let me see. Let me see. Okay. Okay. Okay. Okay. So first, when we play the song on the one item Quickly Sinner here. When we play the song, we have to set the east Some blame to through. So you're gonna say East Song playing hoops ease. Some blame will be set to truth right here. Okay. And here in the wild loop, we have to Jack while song is blame, Right? So gonna say while East song playing end some position these lessons song duration. So you have two checks to do here. So now let's run the out to check your feet. Works again. So, Ronnie, click on file. It is played. If I click on pass the music stops and also the seat bar stops. OK, but now if I click on play, the music resumes. But the Sikh Bart doesn't. Okay, so we have to find a way to recent seek bar to. So when we resumed the music right here, we also have to resume the Sikh bar. Um, so right, human, we resume the music right here. We also have to resume the Sikh bar. So how can we resume the Sikh bar? Um, thing we have to kind of cold is me till the can. Mm. Well, kind of kind of really. Or maybe what? We can do these other master check. Maybe Okay. Okay. Okay. So we want to resume the Sikh bar displaying all this stuff right here. Okay. So we will can create they re some seek bar mito. So we're gonna go and see Bribe it. Um So how did we stop that? First of all? Okay. How do we stop this seek bar? We just sleep the flash. And when we flip the flock the this thing Waas stopped, But we can actually do a can easier Fikse right here. So let's change these beat. If we jacket inside the loop, we can do some useful stuff right here. Okay? Okay. Okay. So we will delete thes e some playing check right here and here inside thes. We want to say ive these song playing. You will open this and we will put all of these rained here inside these. So if he sunk playing, we gonna actually play the song, right? Actually, um, said the progress on the on these things. Let me see if the brackets are okay. Well, that seem to be Kate. Now, let's run the up again to check if he works as we want. So we're installing the up lunch in the op Greek on the music file. Okay. The music is playing a quick, um, pass. The music stops. The Sikh bar stops. I would be gunplay. The music resumes and the secret also resumes. Perfectly compos again. Both of them stop. And if I click, play both of them recently, which is, of course, awesome. But now we're showing thes thes bar as the fold, which we don't want Teoh. So we want to show them on Lee when we're playing the music, so we will hide them. So go to our TVT made that XML file and then these layover in here Do you want it? Contains the play bottoms gonna set it peace, ability to God. And we will have a night be that we'll call them, um, playback buttons. So playback Baden's okay, just the way of calling them. And now we will define them just as a view. Really? So we can find them. Maybe here, maybe to keep these more ordered. L define these. Here's a final view. Um, play playback controls. And who said find people? I d r a. D. That playback Barton's actually controls with well anyway, so they doesn't really modern and now we can use that to hide or show it. So when we play it apart from setting the seat of our visible right here, we will Also said labour controls that set bc ability said BC ability to be simple. Okay, so now let's run the app deceive thes need check works. Okay, Ronnie. And as you can see, nothing is shown right here. Which is, of course, awesome. There's no Bachmann's no seek bars, no states. And if I click on these, then we have our bottoms. Our seek bar in our states. Off the music weaken. Boss, we can resume. Okay, which is awesome. Right now our application, He's working as we want. Okay, So maybe what we want to do is improved. The coda beat to kind of clean up the cold a bit more to make it more readable. I agree. So let's do it so you can see we cover on create meets out with the only thing he 1000 sadly gone from view, which is good. Then we cover permissions, which is the only permission we're using these to read a sternal started one and the cover request permissions called from each encounter. Permission denied. Okay, recover. That's case tidy. A think readable right here. So we have these music played. You need that The music was fires from film music. Least we have immediate player and be the music file. Sung position is a song played on resume. So I think everything is burger Well reading. I think so. Let's actually go back to the op check. We can improve some nails here. So we go to that and of these, we can see that we are here. This song is about to end the sunk ends. But the possibility is still here We don't want So what once to happen when the song ends we want to play it again if possible. Right? So when the song ends right here, which is right here is apart from Pazin it we want to blade from the beginning So we'll set song position are sung position. I hope so. Prissy Shannon, we'll be set to zero. Okay, was the first thing and they will change the position. Next views have been, say, some precision sex view that said, Next said next and we can't hard code zero right here because we it's easier. So we said next to zero and we want to change the the attacks of the bottom so you can say Pause button that set next. Um And here we will said Eat too. Play wasn't. Was it blame? I think so. And I will say, Eve, he's playing. Some playing will be set to false. Okay, we have to seek bar old too. So seek bar that seek said progress to some position, which is zero and apparently it kind words. So we go again. I think it should work again. Let me see if I click on the play on the play button. Okay, even click on the blade. Bolton, what do we will happen here? So you have to set also the MPI media player so to the sun position so I can say empty that seek to sung but station. Okay, so this is the code we wrote. Basically, right now he's 67 lights, six line. So we will run the app right now and check if that functionality works when the song ends. So let's run the song. Let's seek Teoh Almost the end. Let's wait for the end and let's see if the state is changed. Oops. Something off happens. Here we are. We're in. We're not set in the right. Thanks for you. I missed the's had said the first thing I said the 2nd 20 So I have to fix that. So instead of song duration tax view, it is a song Position X for you, Kate. Now I can run the up again to save it Works. So running the up again, clicking on the up, going almost to the end Unless Jacky feed steelworks. So seven seconds to go. Let's wait them. Okay, Okay. The music stops. These goes 00 These goes to play, but the Sikh bar is not. I said where we wanted. We're gonna play again, ends there and it's not working. So you have to set the Sikh bar to the problem is that we maybe need to wrong based on the u I. Traffic to make these changes appear on the screen. So maybe that's the problem. So we'll come up with these guys thing rate your who copied them. We will put them here. It will delete they come that contacts that they have. Okay, Okay. We will move all these cold inside these run enjoy tread bracket. Okay, And now let's run the app to check your feet Words or not. So let's switch that almost the end and see if it works or not. Okay, so it's set to zero. But the Sikh bar is not being reset it to the song Oh, I'm setting it some duration. So this is the problem. So instead of setting to saturation these a thumb ever have decided song precision. So these will fix it. Um So let's run the up again. That's click here. Let's go almost to the end And let's see if the Sikh bar goes back to work its original place. So and it goes back to its original place. Said zero. Did you bother me? Said to play and they will clean a play. And when they click and play these things right here is not being updated. Okay, Why? It's not being updated. Well, simple, because the's cold right here is not called. When when we click on the resume Mito So how can we How can we could call this? Okay, We need Teoh. Call all of these again. Okay, So how can we do it Well, let's see. Let's see. Let's see. Let's see. We can create a mito that contains all of this. We can call it outside outside this grain for global Mito. So we'll move all of this all of this, all of this all of this I think till here I think so with Missy Disease. So be careful. Be careful here. We don't want to select what we don't have to. Okay, let me see. So I will click these actually these one and see where it ends. So on the start one So we're gonna from the start line that start line will select it to the top to the top to the top just before young item click meat We will cut these code and we will se created me Told right here again Say, um Oh, not here. I'm sorry. It's all tidy on recent mito So here we're going to say private boys play sung Okay. And inside these meetings I will paste everything I copied. As you can see, we have these errors because we are not access in them from the inner class. So we have to make those kind of global variables. So, first of all, we will start with position as you can see rate here. But this position is on Lee cold when we do this. So we have to greet a barometer, right? Pearson play songs, they eat position. Okay, We have positioned right there. Okay. We cannot actually, um, call all the other meat sounds if we want. So there's one way when these weak parameters and the other is with global barbell. So I think little verbals is user in this case, just that they must read quickly. So basically, we have to create that these sock precision text view, both of them a global marbles. So I will create those two text views a global as a global barbell. So let's go. And Brits year try. But text view, this was kind of a position. Some position next view And also, um, private text view some duration text view. Okay, which is cool. So we now have fixed those problems. We have to also get with seek bar. So where is the Sikh bar? Where are you? Seek bar seek bar, seek bar. All right, here. So you have to make these also a global variable So private seek bar seek bar. So let's see and make them right here. So private Sig bar local it seek bar. And now we have created that horrible, which is awesome, too. What else? Playback controls. So I did that too. So private view playback controls. Okay, so right, but view playback controls. Okay. Awesome. And we have of course it. Make it access it. Okay, So labour controls what else we have. Let's see what was in bread. So pause bottom. So I have to read up to Private Bob Pause Baden and they cuffed axes it. Make sure you may get global to make a global You want to define these declaration right here. So final bottom, maybe we believe those two boards. And now we have this. And now when we click, anomaly own item clicked What we will do easily following We'll say play, um, play, song, play music, play song and positive position. Okay, so that position how that position will be used. So let's see. Help. Is that position used? So music file least get position. Okay. Okay. Okay. So we have to also the find that position as a global variable right. So we don't really need these right here. We have to create a global variable, so we will go and create private private in position. Okay, But we have to set that position right here. So when the optically Gleason the right here that you see here, what they have to do here is the leaf of Dorothy's parameter Andi outside thes, maybe confuse thes the position. No, no, no, no, I can do that. So I have to change the name to avoid confusion right here. So I will go and change from position to, uh, m position. Right? Transfer the M position. And inside here we also say m position okay and position just to give it a different name to avoid confusion. Okay. And here, right now, before playing Coldplay songs, we gonna say M so I m position equals two position. Okay, We Jeez, of course. Awesome. And when we click on the past bottom right here on the play right here, actually, instead of calling MP start. So then say, if the if MP say ive MP. That or three Sam P. Let me see. Let me see. Let me see. Oh, Okay. Some position, actually. So Eve song position is equal to zero. We will go and say Play song And it's not equal to zero. We will say and be Start. So I think these will work. Okay, because we didn't have any options here to MP that balls get duration. Day said they disorders, Dodge. Ah, yeah. I mean, yeah, that's OK. So let's try to fix the test if it was fixed. So let's run the application and we will click on it. The music starts playing. It was grow to almost the end of the song. I will end for the music to stop. It will wait for admitting Stop. Now the deed has stopped. It's kind of reset it. These to play that here, have a Glicken plate, then it starts again. But the's bar is not working. Okay, so we have to fix that too. Okay, Okay. Okay. So let me see when thes thing works. We have said he's some plain to falls. Okay, okay. Sunk position is less than suck duration. Okay, so let me see what's going on here. Um, the Sikh bar is not being updated. He's sunk playing, so I have to say there's some playing to through which is also sent, right? It's kind of a strange error right here. Okay, Now we work. So why is this company okay? When I click the pause button needs not working properly. So maybe there he's the key to solve this problem on the pause Bottom is not working properly. So again, Andy and did following. So when the pause button let me see. Where is that bottom? Was Boston right here? So if he'd song explain with set it to false okay. And if it's not playing, we said eat too. We said it Teoh to play. Okay, let me see if some position in the zero we will play song, otherwise we will go here. Okay? Okay. Okay. It's kind of a stranger. I think maybe it's some sort of from off thing. Okay. So as a quick fix for these, what I will do is the following. Okay, so really, it's kind of a strange situation here because I didn't really know how to fix this. Maybe something is wrong with we decode a row 10 and really know Bob. Yes. So I think this is kind of very long right now and I think that's it for this video. I hope you enjoyed it. And I see you in the next one by 20. Fixing Thread Related Bugs: Hello and welcome to these new underdevelopment tutorial. This this part seeks have helped to make a music player application for Android. They proved through we almost and the application we have Teoh fix really kind of all the bog way we got. So if you don't remember, it was the following box So if we're on the application So let's run the application. It does a lot of things, right? Old was everything I would say if we click on the on the music file the music started splitting these next few starts being updated. We have also the total duration off off the music file and we have also the past bald in which we can use to boss and play and pause and play and words great The issue waas when the music ended So it will scroll these a bit. I mean, by the way, these girls feature also worked great. And when the issue was when we end the playback finished as you can see, eat well goes back. But when we clicked on the play, bees was not being updated. And as a dull Judith was not a problem. I didn't figure it out in the previous tutorial. And what is the following? So indeed threat. Right here. We're using the problem. Ease that. Were these Isam plying is being changed from other trap. So to fix this problem, we have to do the following. You have to move these line Teoh just before to some positions have zero. So just we have to move the line from here. Teoh here and that will fix the problem. So if we're on the up again, we will check if it works or not. So let's run the out with Fikse applied. That's chrome almost to the end of the of the song. And as you can see, you were waiting for a descent to finish it finished. Now Oakley, come play. And as you can see well sorry. It still is not working. So let me see. Maybe did something wrong here. So is sunk playing said the true Move eight. Kevin installed correctly. Select missy. Okay. It should work right now, So let me see. Let's go and play it again. Let's go to end. Um okay. E vaguely gunplay. It still does the work. So something happened here. It let me see. Maybe these released things. We don't really have to release these, I think so. We will delete that and he sunk playing. We'll have to be sent to through. But it's not kind of working, maybe because of the draft. So let me see. Let me check again. If we're on the up, an ankle, it here and they go to the end, then let's see what happens. You can play buzz in the name click balls. It actually words with something off. He's company and again. So let's check. Let's write a fuse box route here. So maybe the e sunk playing thing is not being accessed correctly, you know? So if it's not being accessed correctly, um, maybe we make Bola tile till maybe if we make it volatile, these will be fixed. Let's see. Okay, so I'm making them in volatile and playing it again. Going back to these and let's check if it works or not. Blais. And as you can see, it actually worked. So making the volatile fixes the problem. It's kind of unsolved problem, you know, it's kind of a difficult to Trey's problem because we were messing here with drat and we have Teoh update these with drabs. And we have Teoh all surround the he may not be for in Stratham. So that's boss. That's play. It still works. Let's try to end it again to see feet steelworks. Okay, so we have to test a lot of abs, You know, even more, Warren, they will be released to production. Right? So now we're gonna clean Blais again, and you can see it has been definitely fixed. So the fees and problem well said, Bullet I Boolean Mullah type to these building right here, which means it can be accessed from different France. Okay, so I think that's it for these BDO That was the ball. We have to fix this kind of short radio, but they're important one because it fix the Bach. And that's it for these curves too. I hope you enjoy it. And they see you in the future course. Thanks for watching by 21. DRAWING APP! Creating UI and PaintView: Hello and welcome to these new under development course. This is part one of how to make a drawing up for Android. So these bt will set up the basics and continue either application. So we open there under this to the I d e and click on start a new under the studio project . He re quicken empty activity and then we click on next is here In my application, we will change the name Teoh throwing, throwing out, for example. Okay. Who said the language to Java on rules Had the minimum maybe a level Teoh 17 this time. Okay, now we will click on finish on. We will wait for the i e to load our application. So we have said these time 17 because yes, it was 17. Almost targets the whole android. Um market chur. Okay, so right now we have or 100 studio project set up right here, and we have to continue to create or drawing application. Do these. We will go to our um Okay. That me kind based right here We will open our manifest file and we will set the DVT orientation two portrait. Okay, so we have said to portrait because or drawing up will be in portrait mode. Okay, so now that we have done this, we will run now. Actually, before running, we will change the bef old layout file with linear layout. So we go under duress folder and then under delay out folder and we right click on the activity main that XML file and we will click on delete. We can make sure you have these two options on checked and then click on. OK, now that we have deleted, we will create a new one. So go right. Click New right click on the layout folder. Right. Click new layout, the research file. And here we will also say, said the name Teoh Activity main, as you can see. But the root element will be changed through Lino layout. As you can see now we Glicken okay on the I ve will generate these new coat for us. If we switch to the text mode, we can see that we caught the Lena layout we requested. If we run these, I will run these on the emulator. So if we run these up right now, we will see how it's looking like on the B by So now I'm compiling and I will run the up on the emulator in the left side of the screen so you can see. Okay, so we wait for the app to be compiled and I will switch to the emulator to wait for the Opteron. So right here will be the emulator which was set up using under the studio. And it's taking quite some time. Maybe the first time takes more time unusual but already installing in launching the app. And here is our drawing application. During now we have thes thought Barbee chose the time and all the notification icons and we have also these title bar which is showing Tattler for up in this case drawing it up. We want to hide these two bars to hide those bars. We go back to the I d e and I'm left under duress and then values folder will open the styles the XML file And as you can see here we can change the items off our current up theme. So Teoh, to hide those bars, we will create a new item, the first being window No title which is the title bar and well said this deal through So we don't want a title And we will also create a new item that will say a full screen with Missy window full screen, as you can see. And we will also said these two through After we've done these, we will run the app again to check if the changes took effect on the emulator device. Sorry, now is installing. And as you can see, there's nothing shown. So both bars are hidden on. All we have is a white rectangle, which is exactly what we want for now. Okay, basically, to draw on the application what we have to do east to create campaigned view which will use the campus object Teoh, draw into the display. Do that we will create an external class. Okay, so our external class we will be called paying view, actually. So degraded external clause we go and right click on there D Java folder and we will click on the package name. So in my case, he's come That example don't throwing up. I will right click on death and click on a new Java class in the name of these class. I will said that Teoh pained bu that just paint you, you know, Spain view and then I click on OK, so now the i d e house created these new class for us. Okay, so it says public glass pane beauty, and we will continue Teoh improve and, um modify these glass toe are drawing up meat. So the first thing we want to do is to extend the view class to extend to be glad. It's pretty simple. We will just type right here extends view. Okay, as you can see. Of course, we have to import the view object, as you can see right here and now we extend the view because you have ah, warden right here. Which tells us there's no default constructor available. So if we click here, which will create the constructor much and supper super, we can do that. Or we can also, um mm. We can also did later manually. But if we go on, did these And just the first. For example, we have thes constructor Justin. Silence. Thes warning. Okay, Doesn't really matter because we will write it anyway later. Okay. Okay, great. So this is the main me tothe right, But we will also kind of past the attributes set. If I'm not wrong, let me see. So after weeks of these, we will create a global variable off off paint in which we will call which we will will be called em paint for doubt. We go and say private famed and we will call the importance. Does this guy will name lost Draw. Okay, so private paint and paint. Okay, so we created the pain object right here. We will start setting up that objects. So we're going to say am paint equals two new paint. Okay. And then we will start passing the parameters we want. For example, um, I will weaken, set different styles, strokes, lots of really useful stuff. So it seems we want to draw something. We will do the following. So we'll say m paint that said anti allergy iss. Well said these two True, to enable Aunt Allison. Okay, great. And we will set deter t true. Just do that. We're gonna say in pain that set the 32 through. So these that basically is mulled settings that we have to set in order for D up make it able to draw. We carried it really important to go in deep. Every one of these. So we will continue right now. So I m pains docked set Kohler and we will We will set these Teoh mm to a cooler, for example. Black. Maybe so. This is the kind of the g the color were drawing with. So we're gonna say caller that black. So you want to said that is default. Okay, a simple Is that so We sat be call her right now. Next, we're gonna set these style off campaign t m pain. Oops. In paint That said style. And is this tie? We will pass paint, actually, take that style that stroke because we will be throwing. Right. Okay, great. And now we'll kind of set kind of the strong, um, a stroke. Um style. Maybe so Am pained. That, um said joke join and here would we will do Will be feigned paying, stopped Join that, um round because you can't around it endings on there as we draw. Okay. And we'll also said the stroke cop, which is again just a static changes that are not that important. Said stroke. Let me see. Screwed up. Pained that cop that it's a pretty stop painted captain round again. Okay, so we've done these, and now we're gonna say the mold kind of extra mall. Which one used that much of a considered too little. So, um, at the c m paint that said X for most games transfer mode moves have to know right now. Okay. And the last one will be set Alfa and paint that set. Al Fatah will said that zero xff make you able to see what we're doing. Okay, so that's it for two constructor me to write. So that's the kind of Maine meter, But we want also to create an initialization mito. We will pass the size of the user of the device screen, you know, So we have to know which side we will be drawing into. Okay, so you're going to say probably could void. Of course. We will have to call these from our, um, main activity class. It will call in it and we will pass the display metrics. We get which of these green size. Okay, this plane metrics, metrics, and we will boss the stuff right here. So right now we cover kind of pain you will still have to implement some more self. But it's extending a view. No difference. To complete these design, we will go to our activity Main that XML file right here. And we will actually, uh, get the view from cold. So the B we created and displayed right here, specified as XML. So how come with this? Well, we will basically set these as ah, inside the frame layout in order for us to you later. Be flexible for us to change some stuff. So creative a frame lay. Albu said we'd much bar and the height two u zero bp. Okay, um, the weight will be sad. Um, we want the grace to abuse with two different weight noted for its simply fight or life. So we want in this case, Teoh, make the paint view. Sheldon, 90 90% of the screen on the bottom. We will have a bar which will use the 10%. Maybe we can change these ladies not that important. So we're gonna said these wait to mine. We were presented the 90% for us. Okay. And inside this frame layout well, actually specify, um, our pain view, which is called. We access it as calm example drawing up that pain beauty. Okay, so the weed off the Spain being will be much parent at the kite will also be much burned. In order for us to accident from coal, we have to assign it an I V so se i d and they d will set. The days will be pain. You okay? Great. So now we have created or pain Be right here and we also will create three bottom bar I was just talking about So the bottom bar will be Alina, lay out. The week will be much parent. Behind will be zero BP and the weight will be one. So these weight one and the other was wait nine. So these occupies 10% on the other 90%. Just simple trick to avoid doing lots of cold and all of that. We solve everything here. Okay, great. So now we can create some bottoms right here may be something that will enable us to change . The colors are of the off. What were drawing with or something like that? Maybe Teoh clear the current drawing, But we'll do that later. Okay? We'll just leave it as it is. And I'll actually set these background Teoh black to created black Kohler. For that, we go on their collars. That XML file and down here will treat and you block color For that I open and say color name will be block. Okay. And here I will specify number sign followed by six zeros. Which these block in hex. Investable. Okay, now we have the block color. If I go, I cannot close thes file and go to Activity Main that XML and this background of thes lena layout, I will set these to block. Okay, so that's Arlena layout. And if I Ron the up now, I can have a nice idea off. What? I just eats right here. You mean I mean, the 90 10%. So the APP is running of and run it again Didn't run for some reason. So the act of Ronnie and we have sort of error made because we have not finished Kolding. Maybe you have some sort of fairer rate here, so let's let's check and look up to see what's going wrong with our application. Let me see. So whenever something goes wrong, we can go to lock cat as I'm doing and finding the actual line of code, it's causing problems. So right here we have that we have some error on or binary XML file. Oh, Okay. Okay. Okay. Okay. Okay. That's great, because we haven't finished our we haven't finished, right. And these glass, and we're already using it right here. So if we still that bees and common thes or delayed for a moment and run the up again, we'll see that it solved. So I'm installing the app, and, as you can see, it solved. And as I was telling you, these white thing which will be or pain view will occupy 90% off the whole screen height, and the rest of 10% remaining will be occupied by or bottom bottom bar. Okay, so that's what I wanted to show you as a quick thing right here. And no, we can't uncommon these again. Okay, But we have to keep in mind, but that before running the up, we have to actually end writing these glass. Okay? All right, ease glass. We will continue to be eating meat. Oh, and we will get the high in the week off. the metrics we were We're passing right here to do that. We're gonna say Eat, hide. We'll be set. Teoh metrics that hide pixels? Yes, but these will return the whole height of the device, which we don't really want. We want the 90% of the cold hide of the whole height of the device. So we will multiply these with zero that nine. In that way, we I create, we get the 90% and we will cast these two double. So as you can see, it says me to constant to double. So we casto end actually from double to end. So every cause it seemed, then everything works. Great. Now we also want to get the week. Okay? The week 1000 change. So we're gonna say in weaved Um, it was a metrics that with pixels, you can see right here. So now we have our hide on our weight, which is great, right? And we want Teoh create are beaten up so it beaten up will enable lost two historically information off our campus there where we draw our stuff, right? So we will create are beaten up and we will, um axes it and initialize it. OK, so we're going to say, beat him up. I will call it, uh, and beat map, for example. And I was set these objects to beat Mark that create beat him up, and we will pause the barometers as for the past week. Then we'll pass hide. Then we will pause the configuration of or bigmouth. So we wanted to be able to display coolers. For that, The most useful configuration is beaten up. That kind of feed that rgb 8888 Okay, so right now we have set up or beat him up, and we also want to set up our campus. So you're going to say campus? Okay? Campus will call these m campus and I will set thes Teoh new campus and I will create a new campus. We'd be beaten up. I set up previously, so I will pass. I m the cheese. Great. Now have graded our campus with are beaten up. Okay, great. So he's basically what we have to initialize in these metals. Okay, so we also will have to deal with colors and all those those sort of things. But for now, we will leave it there and we will create another. Me too. Which will be the arm draw me Told. Okay to do that, we will override the own draw. Mito override Protracted boy on draw. Let me see him. Yeah, on draw and we will get the campus right here on campus campus. Okay. And right here we will kind of save the campus in order for us to drop a new colder or some flaked out. Okay, so we're gonna go and say campus that saved. So these enables us to save a state of the campus. Then what we will do will be we have to access or previously created campus, which is these camps right here. So you have to create these as a global barbell. Okay, so you go before the pain viewed betel and type private campus M compass. Now that object can be accessed from the Andhra meted. They're going to say M campus that said, um, not actually draw caller. We want to set kind into the background color draw. I'm drawn caller. And this background color rule said it's the color that white. Okay, so the background off or driving application, we will be white. Great now we will be fine. How are finger moves through the stream in order for us to draw on the campus. Okay, so we will have to be fine. That to define that we will go to our main activity dot Java file. Okay. Have a go to remain intimately the Java and we will define something that we will call our finger path. Okay. Okay. So we're gonna go after the, um, Creed meeting. We're gonna create a study class for Republicans. A static glass finger path. Okay. We opened the elements right here, and we will be fine. This glass, we cop its own color keystroke week and the path itself Okay, Salford would go and say means, caller, we have seen a stroke this stroke Wheat. Okay. And Bob Oh, so you we a spa that we will imported the graphics one. So as you can see right to your important graphics path. Okay. Okay. Okay. Okay. What? I just did, OK, everything's rate now path and this value call it just Okay, So now we will create a constructor. Me tell we could be finger, um path. So senior path right here, and we will pass he's a color. Of course. Another for sent to set the color blue positive course the stroke. We and we'll also pass the pot. Okay. And inside these, we will just set them. So say thes that Kohler equals equals color the same with the other one. So these that stroke wheat equals stroke week. So we're setting new barometer toe in your path. What we do with wheat touch with our fingers. Okay. And now these that path, we will be said. And now we have created our finger path, which is awesome. So right now we can go back to your pain, view that Java, and now we can finish with our on drunk. Me tothe So right here. What we will do. Ease. We will get the finger pots. We cough under activity main remain activity and we will set the color and the stroke and and all of that, Right. Okay, so we're going to say we're gonna say for since the for each loop for main DVD port May next TV D that finger path. You call these f b, for example, and we will switch it with paths. Okay, So what are does pots right here. So those fats will store the actual bats okay, off our application. So how can we find her? Are actually define those fats. Well, these paths are will be created as in the rate least off finger pots. So we go and create eat a global viable to go ahead and say, private, um, rate list our A list, as you can see. And the data type of these Israelis will be main a TV, tea, that finger, doc. Okay. And we'll call these pass. It was said these two new are ready list. Okay, so now we calf or pots Global horrible. Right here. So what do we have to do now is continue right into for a loop. We open these loop, and we're gonna say Am paint that said caller and will will be set to the path color in this case, F b that color. Okay, now, well said this stroke with medical M pain that said stroke stroke week, and we always had to at the that stroke wit. Okay. We also will set the mask filter to know more for us to make the draw. Look what we want and well said I m pain that set mosque filter. It's a no. Okay. And we will actually throw the pops right now to throw the publican Say, m campus that throw path drill and will pass off course f b that path. And we will also pass the paint and paint. And And this is how we we do these for every loop right here. But now we have actually these ladies changes to the screen To do that, we're going to say, outside the four loop course, um, campus campus, though that drove beat map drum beat him up and entire, these will say m beat him up, which is not accessible again. So we have to make em beatem of accessible for that we go toe or any detailed and make em beat em up a global variable. The same we need with encompass so we can go here and go right, but beat Mup m beaten now that can be accessed from the on from Italy and drop pod. We will pass and beat them up right here and also path positively Kind of, um where we wanted to start from in this case will be 00 so when you start from scratch and never going to see And we have to to pass the paint of these to pass the pain of these we will kind of our create a new pained for D's that we will be called M Beat month paint and we will create that is a global variable so it can create it right here. Go ahead and say private pained. I m beaten up paint. It will created this new paint and we'll pas parameter, uh, pained that ether flak so we can have it three. Okay, now we will use it as our last parameter right here. So we'll pass, um, and beat him up pain. And we've bees. Me. So with these line of cold, we're drawing the beaten up. And after we draw, we will restore the campus So you can say campus that, please story. Okay, so now we have restored the campus, and now we have finished creator our creator, our on Dromi tothe busies for days. Bbo I hope they enjoy it and they see you in the next video in which we will continue working on the app. I see you later. And thanks for watching by 22. Finishing the PaintView Class: Hello and welcome to these new Andre Development to rural disease. Part two of how to make a drawing up for hundreds. And this video will continue working on or paint Butte, that Jap a class. So let's start in the previous two. Thoroughly finished or on draw Mito. Right now, we have to get set up a way in which we can get be events that the user generates when he or she touches the screen. Okay. For that, we will override the on touch event. So go ahead and type at override public. Pull the end on Dodge events, okay? And as prominent, or we will have here motion event and we will call it events. Okay, we opened these, and we will get the coordinates of these events. Okay. So seems it has to return. Boolean, we will return. True. So this will be the last line of these meetings so returned true. And we will continue working on our on touch event. So these events is cold when the user talks this cream. Okay. We'll see how it works just right now, so we will be fine to float marbles. One of them will represent the coordinate at X and the other at Why? So you gonna say load X will be set Teoh event that get sex and float. Why will be said Teoh. Even that get why, Okay, now we will get the action. What we mean with action? Well, when the user watch this cream, when the user that's one action, when the user moves the finger are around this screen, That's another action. And with the user stops touch this cream. Okay, that's another option Action. So I'm going to say for each action switch, um, event about the get action to know which action were we're getting from the user. So the first case will be case that motion event in the case, even action down. So when the user talks, the screams that will be motion event that action down. Okay, Colin. And here we're going to say basically break. Okay, we will feel these later, but for dot for now, live them empty. So that's the first case. Next case will be auctioned. Move. So you're going to say, um, case motion, even action action movie, and we will break again, breaking in the line with cynical okay and the next one Last one will be case motion events that action auction, Um, action up. So when the user stops touching the screen and you'll said also to break So we have three kind of auctions the user can take when he talks the screen and we will use these float to pass them to another Mito, which will enabled the drawing to be created. We share those details. Well, the first meet tone will be called touch Start, which will be sad right here. So if they're here, we gonna say created Mito, which is fry Bet void. Watch start. Okay. And this barometers, we will pause the coordinates right here. So we're gonna get them here for dozens. He floats X and flowed. Why? OK, great. We will open these meat's oath and we will create a new path. So when the user touched this green, we will start a new pot going ahead and access the outer path to call that way. So n find M path will be set to new path. So these means we have to create a global horrible, which is a path, and it's called M path. So it's red because We don't have that yet, so we have to create. So right here, we're gonna type outside meeting. Of course. Private. Uh, pat and pot hopes and a spot. We have two important correct pop in these cases. Ease 100 graphics back. Okay. Okay. So now we have or m path that we can use to draw. So these touch started me health, and the first thing will set in pot. We'll be creating you cloth, right? So mu stop. Great. The next thing will do. We will create a finger path, which Wes created our main activity. So we got to say Main of DVT Hope subscription main activity docked finger. Oh, it was a producer finger pop and called these FP, And these will be set to new. It's a new element. New main activity, that finger path. And we have to pass the caller off what we want the path to be. In this case, we want to be black. Then we can change. It's a color that, um black. So we'll pass the black color and we'll pass the stroke. Wit. So how can we kind of know how weak? How big should the stroke with be okay. Well, basically, we will start with a basic stroke with size, which is this gays will be 10 which is kind of his leam stroke with we Can they then in trees, the stroke with if we want or decrease, I don't think it will decrease, but if you want, you can. Okay, so in touch start, we pass the color. The stroke, We've the color is black, the stroke lead will be 10. And we have to pass the new path, which in these cases and tough. Okay, great. And in order for us to out of these above door to the place in which we stored, the other parts will go and say pops that, uh and we'll say our lefty Okay, great. So we have to receive reset the path and move to to the card in eight. And the user east watching To do that, we're going to say, and God, that reset, and then you will say m fact that move, move, move to X comma white. Okay, great. And now we have our new path. Now, if we want Teoh, keep track off the current movement off the off the user, We'll have to create global Bibles that will help us to deduct. For example, we will create two Bibles to story the current X and Y position. Right? So it goes, say private Flowed X actually knew May maybe m x And we're going to say private try but float and why? Okay, so after we moved to these five little set and save this coordinates for later use, they're gonna say M x, he's set to x, and why will be sent to why? Okay, so this is basically what we will do when touch with torches, start Mito. And where do we have to call these Mito from? Well, we will call it from or untouched event. Okay, so this is the first meets out for his actions. So we will go to our own touch of and visas, which is just right here and in action. Down we have Teoh call touch, start to say touch, start and we'll pass ex and why? And after all, these debut class requires us to violate previous view in the right for us to make it look smooth. So to do that, they're going to say just involve a date. Okay, Okay. Next week of the action Move. Okay, so for bees action, we will create another Mito which me told will be well. It will be the touch. Move metal okay for dad. We will go and create them. Right Here goes a private Boyd watch move. And this barometers again, we would have X and y so float X comma float. Why? Okay. And inside these we will have Teoh kind of get how much the finger has moved from the previous position We chest, which was saved with these Bibles. I'm selecting right now. To do that, we will say the following uploads The X, which means changing next, will be set and with map library will kind of calculated the distance between them. So going to say kind of the bebe friends between them. OK, so se ma, that a b s x minus m x Okay. Said the difference between the current X and the save X will do the same with y So they float the why we were set to month. That 80 s Why? Minus am minus AM Cooks. Why? Minus m y right. Okay, so we have updated these these things right here. And in order for us to know how big of a movies we will have to kind of set the tolerance off range. Tolerance for value created, global final, static Bible. And it will say, private static final float. And these will be called Watch Paul are runs, and these will be said we can change these. But for now, I think it great body will be four. Okay, Okay. So after really find the X and the Y Barbie Ebel's, we will. Okay, calculate the touch. Tolerance. Okay, so for that, I'm going to say Eve, the X is greater or equal Dan botch tolerance or, um, be why he's greater or equal. Then I thought, taller runs. So in either off these two cases, we will be fine piece to kind of a movement. We will assume this is a movement we're going to say m path that, um can move these. So you gonna say coordinating the quiet way they're going to say quad to and we'll pass our first. Your previous part in its and the function of her new coordinate with the average. So good is a M X was the first, then is X and why? And here we will say open breath season will be eggs, floss, M X and these perent city by right to just kind of average it told you. And here we'll pause the same with y. So why? Plus I am why and all this breath, sister, by the way, too. Okay, so now with that, we're moving these and we again update the new coordinates. We are moves so am X will be set to X, which is, um you were Where are we right now and am why we will be set to why, Okay, Great. And we have to call these touch move in same way we called Thought start. So we goto untouched event and on action movie. We're gonna call, touch, touch, move, and we'll again will cost X and why? And we again have to involved eight. Okay, so now we have created the option down in action movie. Now we have to do the action up, which is basically when the when the user is not longer talking. So when the user lyft ease, it's finger from the screen. We want to actually see how the finger was moved and dependent that we will draw a lying if you like. Okay, so we're going to say, Private Boyd, watch up and inside these meat. So we're gonna say AM path, which stores the current pop and we'll say lying to M X eggs and why? Okay, that's it. And now we have to call these Mito from the untouched event saying watch touch ab and invalidate. So basically, work out of finishing the line with these thoughts shop events. Right? Great. So now that we have creator created are untouched event which is rate ready, Touch ap Touch, move on touch start. And we have also created our own draw Mito. Okay, we have Teoh create a mito that will enable us to clear the screen. So we go below these meat self and we'll create. So these make those should be accessible from outside the class or creed Public. Um void, Clear, clear me tell to clear And what we will change will be first the pats a realist. So parts array pots that clear and we will involved eight. Okay. And basically that will be eat for now. Okay. Okay. So we have done that. We have done the units in the paint Constructor Mitos. And for now, we will kind of continue with the BDO and test if all of these even the works Okay, So to do that, we goto our main activity. That Java class. Okay, right here. And only have curies or finger path and our own create Mito. Right? But we have Teoh Teoh, you know Teoh to create more details right here. Okay, so first we will initialize the's on the honor soon Mito which is kind of good practice. So they're gonna over rise protected Boyd on resume. Okay, We opened the element that would say super that on resume and the great global barbell that will enable last to know if if the opposition lives were not so private Ease draw in it. Oh, it's bully and sorry Private private bullion is draw in it And inside the under Sumi tell it will check if negation is drawing itself. If it's not initialized, we will set is drawing. It's true And before these we will initialize Okay, so say in it Draw that will be the Beatles name who will use the initialize or drawing up So we have to create it because we don't have yet. So you go below these and say private, avoid any thrall We opened the meat dealt and we start initializing thes. Okay, so we have to create a paint view we create. You have to get the pain We were created in cold for the other gonna say outside these private painted view we will be set, Teoh. Okay. Okay. Your case of private paint you paint view is just the name. And now inside any draw we will initialize it docks of the XML element. So gonna say thank you and find view by i v artery the that pained view. Okay, don't get paid view. Now we have to initialize the screen metrics, which we will bass to the painted glass. So remember we used the's green metrics. Okay, so we're going to say these play metrics on, we'll call these metrics. Okay. Andi said new These play metrics Okay? No, we will get the metrics of the display. To do that, we're going to say get window monitor that get before display dot get rial metrics and it's probably will pass or metrics elements so they will get the metrics off the screen sighs which we need So we're gonna say enough that we have the metro We can initialize the pain abuse. So to do that, we need to say Spain debut that in it and will pass metrics Okay, okay. And we're basically done and we have initialized or pain view right here. Okay, we help initialize the pain view. And now we also have the kind of ah, off of test if these is working at all. Okay, So I will run the app right now to test if these is working or not. A gay install in launching a DVT. Something happened that think that music I would do it again to see if he launches air rushes and it crashes. So there there's never somewhere in the up. We're going to open love cats and find what the air ease. So we have error inflating class. Okay, so you have sort of a right here. Maybe your pain pain you glasses not correctly created. Let me see. We goto activity main here we have or class or paint beat class right here. Which looks okay. I mean, looks great. No, it looks great. Is true the work. So the problem is not here. Maybe in the paint without Java class. Okay, so we go to the pain Jave a glass and right here we will see. Maybe we missed something. Okay, so extend view right here. We're extending the view on the constructor. Oh, maybe we have to posit the attributes Said's. Okay. Okay. Okay. Maybe these different meats. So let let's start with that. So here in the constructor, apart from the context, we will also say at tribute set and we will call it A T T. R s attributes. Okay. And apart from contexts, we also passed attributes. So maybe that probably wise, incomplete. Now it should work. You let me see. So maybe something else is wrong? I don't think so. Let me see. It looks for me. It looks It looks OK. It looks okay. So maybe that's dear. I will run again to check your feet works now. If it doesn't work, we'll have to see what happens. Well, ok, now we're actually working. So that was the error. And as you can see, if I touch on the screen, I started drawing, which is awesome. Okay, so we're drawing in black. We stroke color with a stroke size of 10 even not wrong. So if we go to the up and change these parameters, we can see what is going on here in touch. Start, We can change the struck with from 10 Teoh Andy, for example. Okay, so I will run the app with 20 strokes with and let me see what happens. So if I touch, eat these now, Speaker, as you can see. Okay. And this is still in block. So as you can see, it ends in around corner. So we have set that up in the end. You need me tell. Okay. So, disease, how are our pain up works? Deasy's for these BDO. I hope you're enjoying it. And I see you in the next one in which we will out more features and making more useful. Thank you for watching. And they see you in the next one by 23. Clear Drawing, Brush Size and Brush Color Features: hello and welcome to these new under development to terrible disease. Part three of how to make a throwing application for Android. In the previous tutorials, we set up our pain view on we will actually able to draw on their application. If I run the up right now, we can check the current state of the up so we can see how it's working. And one, what can we do to make it better? So this is the APP as it looks right now, if we drug on the screen, we can draw in black, as you can see. And we also have these bottom bar in which we have to create or buttons. So a good feature would be to clear the content off the pain screen. Okay, To do that, we go to our under the studio i e. And we open our activity. Main that XML file. As you can see and hear inside the Lena layout we created previously, which has black background, we will create a bottom. So we opened element and type bottom wheat will be zero dp. Height will be much parent and wait will be one and we'll put the I v disease. Barton um, as clear. Okay. And we will also put the text of the bottom as clear. If we run the up, we can see what happens to the U I elements. So right now it's being compiled and we will be sent to the emulator so we can see what's going on with the application. Okay, So I will wait for the complexion Could be completed and thes east. Just one button we will later are more features. So if you go to the app and we have now the clear bottom, which doesn't the word because we haven't said it up in the code. So now we're gonna say up the clear bottom we go Teoh remain activity dot java file right here on in the own resume. Me told after, um after we call the units, Rami told we will get and sad the button for a dollar. Gonna write final Baden. Um Okay, Final button Clear Barton and said peace defined view. But I d r Did I d that clear? Okay. And we will set out the bleak leasing there for these bottom for down. We're going to say clear Baden that set on Click Lease ner New Uncle E. Gleason There. Okay, so the 80 generated this goat for me and inside his own click Mito we will call, um faint view. Dots clear. Okay. Which waas the Mita we created? We go to that mito right here. Inner paint view. It basically says pot south clear and involved it. We will jacket these works right now, so I'm running the app and check in e feet Works or not. Okay, so here I have my up. I am drawing right here, and I will Greek on the clear button. And as you can see, the throwing waas cleared, which is cool, right? So we can no clear are drawing, which is awesome. Okay, so we can do that. And that's a cool feature. So if we go to our pain without java, um, file right here, let me close the bar there for us to better look what's going on here. So these are pain. Be that Java, which basically defines Howard paint view behaves right. Okay, um, these for the first me tell is just a constructor meter that has to be called just once. Then the unit me tailed hassled to be called on Lee ones. Right? Okay, so let me check. What else can we do to do some optimization is and some got some you things through our operate. Okay, Okay. Okay. Okay. So we can first will change the brush size, you know, the stroke size. And we can also change the color. Right? Okay, which is great. So if we remember when we said the color is on the touch, start, Think right here. So here we're setting. Okay. When the user touch the screen created new finger path and we set that to black color and the stroke with 2 20 Okay, so we want to be able to change these values from the u I. Okay, so for these, we will change these guys, these and these with global barbells. So we're gonna say the 1st 1 will store caller, which will be in ain't so we're going to say private een. I will call these Braasch caller, and they will set Thies to call her that black. Okay, so that's our brush color on. We also said the brush size, so we're gonna say private mean brush sighs, and we will set these Teoh um 20. As is the default brush size now right here inside the touch. Certain detailed in the second line, we will change this color. That block we will change that week. The brush collar bird when we just created. And we will also change these throat with with the brush size variable we just created now , Jack, that everything works fine. I will run the app now and see that everything keeps working to save us. It was previously cell running in the emulator. And as you can see him drawing these, it's blocking the stroke. 20. And if I clear drug in So it's working as they want, which is awesome. Now we have degrade away for us to change these to change these Barra build right here. Right? So we have to access those variables from outside these class, so we have to access them from remain activity that Jabba class. Okay, So for data will create Tom Baden's, um, here. So we go to activity main that XML and the first bottom waas the clear bottom. So we also want Teoh um change the brush size kind of make it larger or smaller on also change the color. Right? Okay, so we're gonna go and see another button right here. Wheat will be dear obp. So the same as the previous bottom hide will be much parent weight will be one the Onda. We will create an ID be and these will have to be something like increased the brahch size . So brush size in crease or increase perverse eyes. Um, Raj's size. Okay, I was Hey, brush size loss. I can't disclose Right here. Mm. So first shot as brush size Inc increment brush size right on this text. We will set, um, brush, uh, rush size plus. Okay. And we will create another one of the same, but just to decrease the growth brush size So we're going to go here and duplicate these instead of ink will say back to the criminal and the blossoms ST minus here. Okay, so we have now these two buttons and we will run the up to check e even if they are looking as we want. So now I'm running the up, and as you can see, a have brush size plus and brush size minus right here, which is awesome. Okay, so now we're gonna go to our main activity about Java file. And after we create the clear bottom, we will also initialize the brush size buttons. So we've got to say final Barton, um, Inc brush size and these will be set. Teoh find you my idea Variety that brush sizing. Okay. And we're going to set the listener to these bottom so even say ink brush size that set on Glee police and their new unclean police in there and here we have down quick meets out. We'll do the same for Dee Dee criminal brush size bottom. So I'm gonna say final Baden That brush sighs and you will said Thies defined beauty. I ve are Did I d that brush size deck? No, said the click listener So thick brush size that sat on legally sinner new on click a listener. So now we have these two buttons and these t own click Mitos that will be called every time . Each of them are breast by the users. So to increment brush size will have Teoh change the variables right here. As you may think, the easiest way will be just to make these public and change them So let's test that works . So you gotta say public eight brush color. We have caller that black. Okay, now we want to change that. We're in a changing color. Sorry, we're changing the brush size. So you're going to say, Bob Leak in the brush size, it's to any right now if we go to remain activity that Jabba and we say when increments brush size, we want to access faint view that brush size and we will say brush size plus plus. And maybe that would be enough to increment brush size. Okay, lets test. So that's Ron and Chaki for about the works or not. Okay, I'm installing and running the app. And if I make a line right here and then I press increment brush size and they make another line right here Seems kind of the same. But we will have Teoh click more times here in order for us to see any difference. And, yes, it actually makes the line speaker, as you can see. So as you can see, it's being incremental. The brush size, quite a beat. Okay, which is great. It's working now. We're gonna do the same with the requirement brush size listener. So right here, we're going to say fainted. View that brush size minus minus, and they will Ron the AP again. And check of thes determined brush size feature works so running the app and they make a line, then they present brush size minus. And I have ah, slimmer, uh, line. If I go even beyond that, I have these. So what happens? Invite, go to Ciro, or actually below zero, that cause any crash. Okay, So as against you right now, there's the brush size, which doesn't go smaller. And that in the current leaders, no Russian curing bat. The problem is, when I wanted to increase the brush size it steals, um, is the same. So what? We captivity here. He's going to say two degrees of brush size will check if the brush size is greater than Cyril, actually. So if, uh, one. So if If ain't view that brush size, he's greater than one. We will say paint view, brush size, minus minus is you can see. So now we were on the up and check if that box has bean fixed. Okay, so now I'm running the up and I have this one and I decrease the brush size and I keep decreasing the brush size. Okay, Until I am now, I am the Islamist limit, as you can see. And if I go and increase it, then it becomes thicker. So our buck has being fixed right now. Okay, which is awesome. So now we have changed or brought size variable. Now we want to change or caller barbell. Right? So let's check if we can do that. So for data found that just have to change these barbell right here, which is called brush color. Okay, so we go to main activity that Jabba and we want to change the brush color. So let me reforma thes. Okay, So to do that, we go in great amount of bottoms that will say changed color or something. So after these bottom right here, we're going to create a new button. The week will be zero B because it will be much parent. The weight will be one the i d. Will be changed caller and the the decks will also be changed. Or just caller. You know, I don't have to be that specific, right? You'll run the app and check if it looks as we want. Okay, so we are compiling. And now we're running. And, as you can see here, we cough or four bobbins, which are looking just fine. Okay, so now we've got said the leak. Lisa, There on our chase. Carter, bottom for doubt. We go below these deck Ament brush size bottom and type final Baden. Um, change caller move. We will set these defined by the Arctic tidied up change color. The go hands had listener by writing change colored outset on click lease in their new on click lease. Inner. And when we want to change the color, for example, we want to change the color between black and red. So to do a week, um, testing with these Think. OK, so we're going to say eve feigned view that caller hopes, if a maybe that brush color, actually, maybe that brush caller equals caller that block. So if the card color is black, it will change that color to rat. Okay. Thank you. That brush color set to call her Dr Rath. As you can see, if it's not block, we will set eight the block. So, Pain Butte, that brush collar. It will be said caller that block. Now we have to cover between black and red, which, by the way, are my favorite color. So we can run the op and check if these color changing feature actually works. So go to the emulator. We draw some plain, you can see we breast color and we throw something. And as you can see now it's a bread and we can keep droning dread. And if we want to switch back to block will press color And now it is a block. We can clear these thing and start drawing something. So, for example, we want to draw a three. Okay, bad things is kind of self take so I will decrease brush size quite a bit and I'll go again and kind of drove in three, you know will change the color and I will run a draw the rest off the tree and an expert in this kind of stuff. But well, as you can see you, we can increments decommitted brush size. As you can see, maybe we can change to block and draw something again. Maybe fruit or something. As you can see, you have created or up. And these cast some kind of useful features. But we would like Teoh to change and add more features for these. For example, we will want Teoh these blade the current brush size. Okay, so maybe we want to display the current brush size here at the top. And also the current color and maybe the yeah, so can we. Sweet. We can be switching to more callers later, so we will do that right now. So we go toe activity main that XML on we go before these frame layout we have right here, and we will create a new, leaner layout. So we open element entitling the layout. The wit will be much parent. And the height we'll be, um, zero b and the weight will be one. But now, okay, orientation her son. But now remember that we have said these to be 90% and these 10% So now we will make thes think be this Moeller. So these will have 80% and plus one in 1% right here. So to feed starting cold, we go to her pain view that Jabba and we will stroll to or um, he needs me tell the right here. And instead of zero that nine So we were using people's 90% will change. That was zero that eight. So because we're now using the 80% to draw Okay, So we continue to remain a TV to give intimated XML file and said he will create a couple off useful state. So the first will be a tax pew the way that will be zero BP. The height will be much parent, and the weight will be one the i d for thes text view will be brush size, which will display the card brush size. Okay, we will set the gravity of these two center, and it will set the text size due to any three SP, for example. And we'll also set the text color to black. So it was a text color block, which is a color we created in one of the previous two targets. Okay, so now we have the brush size text. Be right here. Anyone to also create the current color okay to these play the current colors, they're going to say next view, I d. We will be brush caller okay and everything. Now, as we will leave us. It is Okay, so now we're going to go to activity to remain in tv dot Java. And when we any thes we will. Okay, after we ended thes change color thing, we will inundate Excuse. We created so gonna say final text view. Um, what was the 1st 1 to the 1st 1? Waas brush size. Okay, so you guys have rosh size and well said to find me what I've er did I did that brush sighs . Okay, Okay. Now we're going to say and set the brush brush brush size to the people times. So brush size the Tet text said it to 20. Okay. And now we're gonna go and say final next view, um, caller or yeah, brush caller, actually. Brush collar find you buy I d art it. I d that brush caller and go hadn't say brush color that set text and the default calories block. So we're gonna leave. Eats is black. And when we change the color and when we change the brush size, we will have to to change the values of the text views. So, actually, we have to define these before the listener, so we will won't move these code before the increment brush size bottom right here. Okay, so in the increment brush size, apart from increments in the brush size, we'll have to update the new Brahch size, um, volume. So for that, we're gonna say brush size that set text string that value off and will be painted view that brush sighs. Okay, which is great. And we will have to do the same when we de criminally brush size. So I'm going to say here, brush size, brush size that set text, and we're gonna say String that ball, you off paint view that brush size rates. Right? Okay. Now, in the change color, we can also update face. So when we go to rent, we have to set it to rest. So that's a brush color that set text. Newell said eat to rat and the same when we go to block. So brush collar that set text and we will set these two block and now we will run the out the chick if everything works as we want. So what now? It's being compiled and sent to the emulator. And as you can see, I have here 20 and block, which are the default things right here. Okay. If I draw, I can see what a drunk. If I decrease the brush size, I have 19. As you can see Bakery Decreasing it. I have seven or six. Okay. If I increase the brush, size is also worked. It also works if I change color. It goes from black from black to red. And I know that I'm on red. If I changed, these can keep changing. For example, we have black and red. But what if we want to create a sort of front you razor? We want to create a kind of wide colder to erase some stuff. Right. Okay, so right here, we gonna go the cycle red wides and block movie at the end. So going to say if they're going right else teeth. Um, caller. So if it is black gold to read now, if it's red, we won't go Teoh White. And if it's a wide go to black, Okay, so he would check if it's rent. So painted view that brush color equals two caller dot rent if it's red and we can't complete these else statement so it's not mercy. Okay, so if it's ready, we'll go to White. So we're going to say famed view that, um, brush color it was had to color color that white. Okay, awesome. Wide. And now we have to update these subtext as well. So brush color that set, vexed who was set to white. And now we will run the out to check if it works or not that if implemented in your razor right here. Right, cause racer is useful. So you have black If we change the color, we have a rat. If we change the color, we have white and with white we can kind of the elite because thieve accurate is wide right . And after white, we have like again. Then you have read and then we have white. So you want to do with a lot of stuff? I'm gonna increase the brush size maybe by 40 her something and I will want Teoh. I believe he's more easily, as you can see. Maybe even larger. Maybe something like 50 or even 60. Okay, you can see is way thicker and I'm deleting everything. That's a It's on the screen if you want. If you want to lead everything and wants us breast clear. Okay. So we can color to block. You can see an a plus. Clear. It's deleted. So I hope you enjoy these BDO. That's it for these video. I hope you enjoy it. And I see you in the next one by 24. Thank you for finishing the course! What next?: thank you very much for finishing this class on skill share. Will you please leave a review on the class? Because you've spent so much time here? I imagine you've loved it and found it helpful at some point. And every one of those reviews will help other students to have the same experience as you . We do this to help you have a android career that allows you to work online from the comfort of anywhere to earn enough money and to be of true service to this world. By focusing on skills that allow you to earn the most in the least amount of time and do work you love and enjoy. We appreciate you being here in this class. We've got two more classes. You haven't watched them already. We think you might love and enjoy. One is named android studio emulator Set up web. You add mom mobile ads, integration and calculator app coating. This is a course by the exact same main narrator as the one we're and now this will help you get ab Bob adds in your APs. Help you get started building your emulator. Set up your web view and build a calculator app. If you've enjoyed this class, I think the studio emulator set up will be the ideal next course for you If you want a in depth learning experience all brand new in terms of the proximity toe. When these were published at which is currently April 2019 the master of Android Development course you will love This is 12 more hours currently and we're continuing to add more to this course each week. This is a really deep course covering everything from start to finish. You might enjoy some parts of this course to help you on your coding as well. And if you'd like to get more classes with me, we've please that that follow button because every week on skill share, I'm publishing courses that I imagine you will love and enjoy and find helpful for your professional development. What I do is I have education and publishing company online as and I put it all under my name because I narrate some of the videos and what I do is I find the best skills for you to learn. I find instructors that do a good job teaching those skills I work with the instructor. As I've worked with your instructor here in this course that to make the best student experience for you to teach you skills, I come up with the course title ID Co over the course outline with the instructor. I make sure that often the people I find have not been in the habit. They have the skills like android development, but they haven't been teaching it. I find people to help teach these skills, helped get them set up as a video instructor and then get the videos out to you. Here. I appreciate you making it to the end of this class. I imagine you'll love and enjoy Ah, lot more classes with me. And you hit that follow button when you want to see more of them. I love your awesome. Thank you for finishing this glass on skill share, and I'll see you in another course