In June last year I gave myself the goal to create an Android app by the end of the year, except with only the most basic of Visual Basic under my belt.
Battle of the IDE’s: Android Studio vs Eclipse
IDE stand for: Integrated Development Environment. Wikipedia sums up what an IDE is very nicely: An IDE is a software application that provides comprehensive facilities to computer programmers for software development.
At Google I/O last year Google released Android Studio, still in Beta, the Android Studio IDE is the upcoming replacement for the aging Eclipse IDE (Which I have never used for more than ten minutes).
Having not used Eclipse extensively at all I can see the choice in which to use between the two is obvious: Android Studio – It’s rock solid in terms of stability, it look and functions better AND somewhere down the line when Android Studio is the obvious choice (it’s development is insane, there are updates weekly) you’ll want to move to it anyway.
One of the requirements for Android Studio is the Java JDK, which can be found here
Once that is installed, download and install Android Studio No need to open it just yet.
But you’ll have to know more than that to have a good understanding of Java, so I highly recommend just watching and trying to understand these videos/tutorials until you understand how Java work (If Statements, Variables, Returning Variables, For statements, basic syntax, Basic math operations):
This starting point is really helpful, read each page from here and try and understand what is being explained. Whilst that read-through has all you need to know to start, these videos may help.
Protips before we start
- Don’t give up because it’s initially hard, there is always a big cliff where you suddenly just understand what is happening, for me it happened a few weeks after starting my app.
- Google everything, If you have a problem someone else probably has, just Google your question and look for answers, /r/androiddev is another great resource.
- Follow Android Design Guidelines, it’s much easier.
- Icons and Buttons
- General Android Design Resources
- Design Inspiration – This is a big one
- Google’s Design Philosophies
- Android Holo yolo Design Index/Info
Android Studio has a drag and drop editor for the design part of an app, but you’ll have to learn the XML part as well in basic (spoiler: It’s quite straightforward)
Android Development: The Basics
So you might have gathered that Android Development is not exactly the same as Java development, so I highly recommend watching this (Just to get started):
This one might seem silly at first, but as someone who forgot to do this and has to redo it all now: DO NOT AVOID THIS. A string is a sentence, character, word, numbers and a combo of them all. They are used all the time: for dialogs, debugging, textboxes, UI and more.
The problem is that if you have 700 lines of code and you want to find 1 string to change it in the future (or translate it), it becomes extremely fiddly – so Google created a solution, a single file that stores all of your Strings in one place, so you can get that one file translated and refer to those strings in tons of different parts of the code.
So if you had a standard string for dialog like: “This feature is not available in the Free version, would you like to purchase the pro version? (Don’t do this to often!!)” which you use several times, all you’ll have to do is change the String in the Strings.xml file and it will affect all the dialogs. This also makes it super easy to translate (My biggest regret in my app – I’m working on it).
Google have a more thorough breakdown here, and as a heads up, there are equivalents for this method for numbers and other variables!
Comment and Document
Try and comment and document everything you do, want to do and have done (even just a dot point with a feature). Eg:
//Scan for video files
insert code here…
Some more Basics and how to start:
Open Android Studio and create a new project, following all the prompts, then it will create all the main files and folders necessary automatically. With what you have learnt use these resources, your ideas, what you have learnt and any other tutorials to start making a basic, then more complex app.
Think of libraries like pre-made code that make completing a task in code much easier. For example, my favorite library: ‘IO Commons’ shortens all File manipulation tasks into one line bits of codes, where they sometimes might be 10+ lines – this made my app significantly easier to code.
There are specifically made Android libraries from Google that allow you to use newer Android features like the Action Bar on older devices. Libraries differ in how to add them to Android Studio, so you might have to research how to add them to Android Studio.
More advanced Pro-Tips
- Just like the String resources method, don’t hard code anything – workout out how to most simplify and make adaptable your code for future changes (especially translation and when you become much better at development)
- Stack Overflow and YouTube (and /r/androiddev) are your friends.
- Follow Google Guidelines.
- If you don’t really understand some code or how to do a particular task, Google it, comment what you are trying to do and ask around.
- Use libraries wherever you can.
- Here are a lot of awesome Android feature breakdowns and how to implement them
- The activity life cycle is super important, learn this: Activity Lifecycle