Learning To Write Android Apps
The process is pretty straight forward. Here’s the short version. Learn Java. Get familiar with the Android API. Walk through the tutorials. Learn to use search to answer questions on how to do something. Get an account on Stack Overflow and participate (ask and answer questions). Think up an app you want/need and get coding.
The longer answer
Whether or not you already know a programming language, you have to learn Java. If you already know a language—any language will do—picking up Java probably won’t be that hard. If you have never programmed at all, decide if you really want to write programs. It’s tedious, exacting work and not everyone has the focus to write code.
Your program will do exactly what you tell it to do, even if you don’t fully understand the methods you are using. You have to learn to interpret often obtuse documentation. You will have to experiment with new methods to see what they actually do. You will have to troubleshoot obscure errors. You will have to think about what happens if there is an error and how you will handle it. You will have to have to communicate clearly and succinctly with others when you ask questions or propose answers.
Your reward, or at least the reward I get, is having a program that works which you can share, improve, and use. You will also get a better insight into how computers work and communicate. It’s fun.
Learn Java
I can recommend Big Java by Cay Horstmann. It’s a text book but the explanations are fairly clear and there are a lot of examples and exercises. Sadly, you can’t get access to exercise answers if you are not a professor, but don’t let that deter you!
You can buy the book or you can join the Association for Computing Machinery (ACM) and get it as part of your membership. The ACM library has other Java books as well, so it’s useful to join. There are other books but I’d suggest avoiding Head First Java. It’s an OK book if you use it with something else or you have Java basics under your belt, but by itself, it’s not going to teach you what you need to know to write Java programs.
While you are learning Java, also learn how to write Javadoc and get in the habit of documenting your code using it. Once you build the habit, you will be able to generate documentation for your code easily. As you build your own libraries, your Integrated Development Environment (IDE) like Eclipse or NetBeans will be able to use your Javadocs to show context sensitive help.
Also learn how to write unit tests using Junit and write them even for the silly little setter and getter methods. Again, it’s a good practice to start early and you can easily test your code using unit tests. Your first set of programs as you are learning are going to be easy and your unit tests will be easy to write. As you progress, your methods will get more complex as will your unit tests. Seriously, take the time to learn Junit. It’s not the only testing you will need to perform, but unit tests will cover basic issues.
I’d also suggest using what ever IDE the book you are using recommends or uses in their examples to make your life simpler. There is no value to write Java in a text editor and compiling on the command line. You won’t spend any of your time doing that once you start coding so why learn now? If you ever get to the point where you need direct control over compilation, you will be skilled enough to handle it. You will be using an IDE most of the time while developing, so you might as well use one from the start. Frankly, IDE’s are very similar, but if you use the one your book uses, the learning will be much quicker.
If your book doesn’t use an IDE in the examples, I’d suggest using Eclipse at first simply because the Android tutorials use Eclipse and Android Developer has detailed set-up instructions for Eclipse. You can develop Android in any IDE that supports Java, but if you don’t have a preference, start with Eclipse. Big Java uses NetBeans (an earlier version than is available today) in the book, so I used it first, then migrated to Eclipse later. Many people like IntelliJ as well.
Learning Android
Android apps are written in Java but Android is an environment with an extensive set of API’s that define the objects and methods you will use to create apps. The quickest way to learn is to go through the tutorials and rather than downloading the examples, write your own and see how they work. There are also videos on The New Boston which some like very much. I haven’t seen them, but I will be watching a few. Personally, I learn better by reading and doing than by watching and doing, but that’s just me.
Seriously, write as much code as you can. It’s the only way to learn Android. You can compare your code with the examples to see how it fares (the example code may not always be best). Developer.android.com is going to be your friend and you need to get to know it very well.
Start out with a simple idea and learn how to create an app that you designed. Create the layouts, the images, everything. Keep it simple so that you can focus on getting it working and then either come up wit more complex apps or keep improving the same one by adding more features.
As you progress, create mini apps to learn more complex things. For example, I wrote a number of apps so that I can learn how to use a database, launch an intent, launch an intent with extras, etc. These are focused little apps that do nothing but help me learn aspects of Android that I can apply later.
Get Involved
Join Stack Overflow and learn to use the search function to find answers to questions. Answer questions when you can. Get involved. SO is not chat system or a forum for general chat. You ask a specific question to wait for answers. Learn to use the SO editor to properly format code examples so that others can help you. Frankly, if you don’t conform to the formal and informal rules, you are not likely to get answers to questions.
Good questions are along the lines of “here is what I want to accomplish”, “here is where I am stuck (and why)”, and “here is my code that I have written.” A bad question is one like “I need to open a new window, how do I do that?”
How long will it take?
How long will it take? Who knows? It depends on how much time you have to spend learning. How quickly you pick up Java and Android. How quickly you can assimilate the Android Way into your programs. Whether or not you have an affinity for programming (not everyone does and that’s OK) and a numerous other reasons.
I don’t call myself a programmer (I don’t think I am good enough for that title), but I can write code. I am self-taught in Pascal, Object Pascal, C, perl, php, TCL, shell (Bash and c-shell), Dos batch files, and a few dead scripting languages.
My experience was that it took me a few months spending 5-7 hours a week on Java working through the Big Java book before I could start learning Android. I was basically to the point of learning objects and just starting to get into interfaces and so on. I am still learning Java and Android. Your mileage may vary.
-
bluntbros reblogged this from mfratto and added:
The process is pretty straight forward. Here’s the short version. Learn Java. Get familiar with the Android API. Walk...
-
mfratto posted this