For the record, this is how you will learn Android Programming. There are tons of content where you will not understand anything in the beginning. If you want me to teach programming, i will not, atleast not now. The major reasons are primarily because, there are content out there from which i learnt it myself and the need for redundant content is not appreciated.
Alright, now once you are done with the searching what have you understood.Do you know the following three words?
If you can understand those three words, very well done, you have not spent only 10 minutes like i said. You have spent more than that to know a bit more than what is given. For starters, thats how the language opens out itself to you. Few minutes of searching here and there wont give you anything, it comes with constant updation of the concepts that you want to master(Interest in short!!!).
Now that you have understood(Which i think you wouldnt have, did you google those three words at all!!) lets jump onto the next thing that can help you with making your first app here. Dont worry, no code will be given here for you to copy paste. You are going to do it yourself, and yea its not a “Hello World” app for sure!
Learn the environtment that is going to be with you when you create your first app (By environment I mean IDE)
Do you know what an IDE is? Which one do you use for Android? Studio? Eclipse? The thing is, it doesnt matter, and it never will. When android was first created, it was completely new to lots and lots of programmers, and they used something as basic as a notepad to create the applications.
Can you believe it, Notepad, no autocomplete feature, no error showing you have missed a semicolon. Then it took lots and lots of hours to make it simple for a indie developer to create an app that he/she can post and expand the community. The Android Studio is something that i recommend for any starter, because, it is Android Studio
(It has got Android in it!! )
As soon as you install it and open it, it spits out a new Android Application and you are taken through pages and pages of creating your first android App with a blank white screen showing. Great!! Your first Android app is done!!
Ok, no cheating, now the thing is, you have to go through the process of creating the first app. You are taken through pop-ups after one another. You dont have to understand everything, but if you have understood my first point, you will be googling everything that is coming up to understand what is happening.
Just remember, there are tons of people out there, that can break the content and feed it to you, you just have to find it. Dont forget to google all your way till you create a simple Activity and a simple LinearLayout.
The next big step. Learning the “Views” (You should google that now)
The answers would have shown tons and tons of Views and things you can do with them, but what did you capture. Did you capture about TextViews? Did you capture about Buttons? Great, lets put that into action now.
Now you have read and googled what a View is and what a ViewGroup is, it is time to impement the first step in creating a simple layout. Place the TextView inside the LinearLayout and give it a ID.
Place a button inside the LinearLayout and give it a unique ID as well.
Great! Now if you see the design part of it. You will see a TextView and a Button below it. This is super work, but what is the use of these two.
We will start off with a fairly medium topic for starters itself because, you are great with google and you can google any hiccups right away and get them to work.
As soon as you have a TextView and Button, lets try to solve the following problem statement
“When the button is pressed, a counter should start and we have to show the incrementing value in the TextView every time the button is pressed”
Problem is fair enough? Can you do it?
Lets solve our first problem together (Time to make lots of mistakes I mean!)
Now that i have laid out the problem statement. Switch to the Activity which is responsible for the functional part of the App. Anything that we want to work, will be done hear. With work, i mean, the brain will be done with Activities and other concepts that we will see later and the XML can be seen as a design for this brain.
Alright, now that we have a button, we are going to click it and something has to happen. If you google “Buttons in Android”, you can find content related to different styles of buttons and more. We are interested in capturing when the button is going to be clicked.
Now, we have a problem in hand, we have to know, when a button is going to be clicked. And whenever it is going to be clicked, we have a task to perform. We will solve this first, get to the point where we create a Button variable and link it with the Button that we created using the unique ID that we attached to it in the previous step.
It should be something like this
Alright, i said no code, but come on that is not even a part of a code, its just a piece of code. Once that is set, we have a variable that is now pointing to the button. If you are stuck at this point, i can point you to this place
where the button creation and linking part is present. Dont try to understand all of that and confuse, we can worry about beautifying a button later, we need to first link a button with the ID present in the XML file.
Now, coming on to the next part. Button has been linked and now we have to wait for a click.
Yes, thats it. We have to wait for a click. We have to wait for the user to make some action. You dont have to worry about the how part, because it is being carried out by a process called Listeners.
As the name suggests, Listeners, listens for some user action. You just have to set it to any view that you want to wait for some user action. We need to wait till the user clicks the button, thats why there is something called a onClickListener().
Get googling right away. Did you find what am talking about? Do you understand how you are going to set the onClickListener to the button that we have here.
Once you have crossed this part. We can cross the next half easily. We are simply going to redo the process of linking a TextView Variable with the ID like we created for the Button and set some text to it.
Closing up with a final product in hand (Run it and Debug)
You have created a button, set a onClickListener to it, when clicked you are setting a value to the TextView. You got all that right? The problem statement says, increment a counter and set the value to the TextView. Can you do that? If you cant. Dont quit the browser and thow away your computer out. Google first, get the search engine cranking for what you need. I am here to give you the direction on how to start. This will be tough because, you are starting and its not even 1 hour since you started and you have already read a lot of information.
Once, you are done with the creation part, you are required to run the App and see the output.
Android studio has a built in system called as an Emulator, but you can even project your app on a physical phone. I hope, you dont have to waste a lot of time on trying to setup a emulator, especially in not so memory heavy systems it can be very daunting.
The purpose of this section is to learn about Debugging. Debugging anything can look very tiresome in the beginning, but it is very very important if you are going to grow as a developer.
Try to read the things that are being spurt out in the console. You get to see lots and lots of lines filling your log. When you begin to understand the errors and mistakes you have made you are finally becoming faster in solving your hiccup points. Most of the time, people debug their code for errors, rather than finishing up a module. That is the nature of this language and it will continue to be.
Be at the top of the system and correct your mistakes very quickly. You can grow as a developer way faster than you can imagine.
If you think, this is very vague and nonsense information, that i have taken time out to create for you. Be mindful, this is how the top developers learn. They dont copy paste their code and read a entire website for content and then start coding, learning along with coding will make you a better person in the Android World.