Android Application Development Tutorial for Beginners – #3 | 2017

Android Application Development Tutorial for Beginners – #3 | 2017


what’s going on guys welcome back to the brand new android app development tutorial and this is the 33 where we are going to take a look at how to program a android app so in this case i’m now first of all i’m going to open the android studio so yeah we have the dark dracula background for the android studio from the last tutorial so what I want to do is changing the background into white again so going to the configure selecting the settings now going to the up your end and from here I’m going to go with DJ clicking that play and there you go ok so let’s kind of new to that our Android app project so everything is done really faster because we are using this continuously again ok anyway today what we are going to do is that so first of all before that I want to say that we have a text view inside this app we have a button so I’m going to go and use this button in this tutorial and it I want to remove this text view so I’m going to delete that one ok so now we can see we have a layout file with a button and looking to the button we can see here is a text that is quick me used to the string resource now at the top you can see here is a button i ed that android colon ID equal to i plus ID / button so what we are going to do is them how to add an action when the button or the user presses button we have to add an action so action can be anything like changing the button text or changing the button color or background color or even we can use the external item as a result so like that when i when they use to click that we can also give a popup message saying that yeah you click the button so language we can do anything by a symbol button click so all you have to do is you how to just remember the name for the ID of this product so in the in this case we have the ID as button let’s go to the main activity door Java you can find the same file as I said you can find it by going to the main root folder that is app and instead that we can see the Java and go to the first folder inside the Java and here is the main activity don’t Java ok anyway we how we’ll discuss about the main activity and the structure of this main activity and the java files in the first tutorial so anyway once again I am repeating here is the package name that you have given at the first or at the beginning and here is the inboard and public class and inside that two bracelets open and close we have the one create method added here so first of all here is the package name and everything is here and now let’s go and before adding a button we have to be familiar with this course so we have used it a 10 / right protected void one create method and so this method insert some of the main elements required for your android app so you know when you’re looking to this course you can see here is a matter which we can easily identify what the use of this so here it is Ted content view and in the bracket you can see that is outdoor layout door activity been so so the content view is a method that used to set the layout of the Android Apple as corresponding to this class file so language and this as the Jaguar is a high-level language as the high level languages are similar to the English words it is easy for us to identify each course so anyway what we have to do is that we’re going to be adding a button as I said so we have the IED for the button ass button again and we are going to the main activity and reducing the button here so under the public class mainactivity extends up compact activity than bracelet under that we how to add a line that is but tan ok now you can see when i type button you can see here it shows in blood clot which means which represent that there is error and the error is that cannot resolve symbol button so that means java cause cannot identify that user type of value user type character so that means all we have to do is that when we are inserting a widget into the Java class how we have to do is just type it like an upper caste letter at the first let me type x button so when i type button you can see here is a proper shows that do you want to import the button as a widget into this category so I language that’s all you have to do is just double click on the button now you can see it’s added a one more line in both android widget button then semicolon so let me remove that one thing okay now again I’m typing button so if you haven’t seen this pop-up you can also if you if you’re only getting a similar that you would only return that and but you doesn’t get a pop-up than the alley how to do is just keep your mouth or the character just give it a one most button left click then and then you’ll be getting a pop up like this if you if you haven’t yet no problem just just press all the end there just like how you have extracted the string in the activity main.xml in our series to like this when you press alt enter you can also import the same button through the top up so finally we have we added a button but what happens if the user has more than one button let’s see okay i’m going to copying the same now changing the button into button to button three okay now as you can see i have three buttons in my activity and i want to i want to add each click listener for each of these buttons so adela can can identify which the button we are intending to add a click or what we are going to do with that particular button so all we have to do is we have to view name for each balance so like where it’s in case of java programming or many other languages we call the name as variables so the variables are a particular type of characters that represent each balance so like ways let me show you an example so this is the first we have introduced the button to this devil class and now we have to insert a variable of name for each button so let me go with the BT so I represent the button as BTW so let’s suppose i only have a single button now i have added a bt let’s let’s add a beating one ok now it’s buried one now if you want to add the second button all you have to do is just copy this again face it here and change that video won’t ability to so now you can see if i have a 100 button I should keep doing this all the line but it is rotating it is that doesn’t make any sense of writing an android app instead of in that case instead of making an android app you can do it manually so our goal is to make everything simplified so for that you have to simply if you have multiple button you have to simply add a comma 1 after one variable then again give you a space or not for a beauty i’m giving it a space again i’m typing the BD to again giving the comma again giving it stays and having the third one bt 3 now you can see there is no error up to this but the final you can see here is a small error that is expected a semicolon so Java is as I said before the Java is much very easy to learn so so you will be reminder about the mistake that you have done in the program so like wait here it is expected semicolon so why not we can give it a semicolon let’s add a semicolon now as you can see there is no any kind of errors and even the main activity door java I would know any kind of errors when I remove the semicolon you can see here it shows a red underline that means that represent the arrow again I’m adding it now there is no errors so like ways we can add more and more button into this so I’m gonna go with this one on one and reviewing all the other buttons now like with am removing all other burns from the layout now we only have a button so the ID of the button is button itself let me go back to the main activity to Java now we have to add a listener for the button so when they use the press the button we have to give a certain activity for action for the button click so like that language all you how to do is under the sit command view we have to view some other lines so the first line is to be introduced button inside this one credit method so all you have to do is just type VT 1 so that is the variable name of the first button so be d 1 equal to what is that what is BD one so what you have written is only up to here what that one create method doesn’t know what you have written about we how to teach that one create method what we have given at the top so like ways we how to add be t1 equal to and inside the bracket you how to type button so you have to add the variable and main head for the variables inside the bracket so once you have added button inside the bracket all you have to do is just I prob find view by ID so you don’t have to type fully by just pressing enter that will be auto completed now we can see shows that hid rust in the ID so in this case it says that you how to mention the ID for these variables so we have the first variable beauty and in the activity man we can see here is a button that the ID name of this pattern so like this we’re going to be adding them ID for introducing the idea into this one create method so outdoor LED door button so now we have then finally or it again expected a semicolon so all you have to do is just added ok now there is no errors so now the oncreate method know what is believed one so finally we have teacher the one create method that BD one easy balance so again finally we have to add VT 1 again then now in this time we have to add dot then set one click listener so when I tab said we wanna click listener you can see the pop-up you can see that one click missionaries already Sean let’s click on that I just double click on the first result from the pop-up now you can see again expected something inside this bracket so all we have to do is just type a new because this guy you see a new anywhere one click listener so when i type new one click listener you can simply double-click on the faster results shown on the crop up okay double click now as you can see when I double click on them onclicklistener all these lines are already returned by the Android studio so that make really more easier to type each course so even at this point I didn’t get any kind of errors that you can you clarify if there is any kind of errors by looking to the main activity dojo or whether it has the underline or not anyway we have the public void one click view dot view and blah blah blah many other things so all you have to do is if you want to give an action for this button all you have to do is just add the action under the public void one click method so in case of button and many other things we have to use one click method to show or give an action for the button so in my case we have the button vd1 okay so Billy one is the variable name that we have given for the button so b1 do so what we had to do so in this case we have where many options that we can follow up so let’s suppose we want to show a popup message when the BD one is clickable so again I’m remaining the b1 is this pattern so when the user is in the app when the user presses button we have to add a certain message to be pop it up when the user presses again ok so I’ll be how to do is in in Android app development we have a method that is toast which shows the popup message for the users so I’m going to go with the popup message I want to show popup message when the user click this button so all you have to do is simply we have the type for toast leather bob is known by the name tossing that java programming when i type with close you can see also its imported the android widget toast so totes easier part of rigid in the android okay anyway so all we have to do is decide toast so toast or make text then again get application conducts then come up and your text here again add comma and we have to give them toast.length duration or whatever else you want call it okay now you can see how added the set of exhaust and the matter and here is the popup message and we have also introduced the time duration for the toss and finally we have added dog show so if we further to add the dog show and we just completed the toast by a semicolon the toast is not going to walk in an android app so we have to finally add those show and we have to shop with the semicolon so at this time we have seen there is no any other kind of errors we have done with this soul and so final step is that we gonna run this app in a live device and check that out in order to run your app on a lab device you how to connect your android device through the USB cable and make sure that you have installed the USB drivers corresponding to your android device so once you have connected you how to go to the run which you can see here you see a green button or you can go to the run from here and run the app and you can also use the shortcut shift + f10 so i want to click on the this button you can see here we have the option to select the deployment target so i have connected my personal phone to the USB cable and you can see here it is connected so now and I selected this one clicking on the youth same selection for future lon just because I want to use the same device and I want to launch in the future so that you can avoid getting the sims window so finally you how to select your device and click on the ok and there you go once that is complete you can see you our Android app will be running on your life device or yea you can see when I press the button the message is shown then the prop up is shown by a toss I hope you guys enjoyed watching this tutorial if you want to go more professional you can subscribe to my channel and can be watching the upcoming series so if you end up with any kind of errors you can probably comment below and i will be showing you the right solution for that thanks for watching either hope to see you in my next tutorial

18 thoughts to “Android Application Development Tutorial for Beginners – #3 | 2017”

  1. hello sir,
    i have this error
    "Error while waiting for device: Timed out after 300seconds waiting for emulator to come online."
    i have tried more time but it has shown every time same problem
    please help me to fix this err.

  2. Thank you for these video! It helps lots.
    However, I am facing a problem which is I can't have the apps while I test run in Android Studio. could you help me?

  3. i just learned two things on this tutorial., how to make a button do something and understand how you talk. geez my head hurts.

  4. Once I click on run, i am not provided with any options. Its just not responding to that command. Any help?

  5. I have encountered two problems which are:
    1.Every time i start my studio it says uninstall older version and the file is re downloaded and it takes time to again download 1.8gb
    2.Cant connect my phone to android studio, even though it is connected to laptop but isn't connecting studio.
    Help me out please.

  6. i connected my personal phone through usb cable to my lap, nd i cant see my device. i canceled nd then again clicked the run button but nothing happend, it didnt even show the select developement target window….now showing edit configuration window…what to do?

  7. Hi sir,
    When I added multiple XML files, I am getting errors saying 'activity_main cannot be resolved or is not a field' for the line setContentView(R.layout.activity_main);

    In fact, every item which I used previously in R.* is now reporting error. I don't know what went wrong. Can you suggest what needs to be done?

  8. Hey nice work you are doing …pls you help me out my main activity does not show public class just class….am using version 3.0 pls help me out …thank you

Leave a Reply

Your email address will not be published. Required fields are marked *