Page 1 of 4
Android represents a big potential market. It is also the most open of the "big" phone and tablet platforms. You can write a program for an Android and let your friends have a copy, keep it to yourself or put it on sale in an app store. While Java has until now been the programming language for Android, now there is the choice of Kotlin which is, in fact, an easier and better option.
Android Programming In Kotlin
Starting with an App
Covers Android Studio 3 and Constraint Layout.
Is now available as a print book:
Buy from: Amazon
- Getting Started With Android Studio 3
- The Activity And The UI
- Building The UI and a Calculator App
- Android Events
- Basic Controls
- Layout Containers
- The ConstraintLayout
Extract Bias & Chains
- Programming The UI
Extract Programming the UI ***NEW!
Extract Layouts and Autonaming Components
- Menus & The Action Bar
- Menus, Context & Popup
- Beginning Bitmap Graphics
- Staying Alive! Lifecycle & State
- ListView And Adapters
Android The Kotlin Way
If you are interested in creating custom template also see:
Custom Projects In Android Studio
Android phones and tablets are comparatively cheap and this makes it easier to get started. What is even better, all the tools you need to create an Android app are free. You don't need to pay anything to create, or distribute, your Android apps. If you want to sell them using a well known marketplace there may something to pay – there is a one-time fee of $25 to register for Google Play, but you don't have to use any particular distribution method.
All that stands between you and your Android app is your imagination and programming ability. I can't do much to improve your imagination, but I can help with the programming side of things. If you are new to Android programming this is the place to start.
In this book I will show you the fundamentals of Android programming. Not the tips and tricks, but how to think about what is going on. You'll be introduced to the general principles that will make it possible for you to master anything that you encounter that is new in the future. It isn’t possible to cover all of Android in one book as the subject is very large. Instead we focus on the basics of creating a User Interface (UI) as all apps have to have some way of interacting with a user.
There are many ways to create an Android app but Google's Android Studio is an easy to use Android IDE – Integrated Development Environment – and it is now the recommended way of doing the job.
Before Android Studio you had to use the Eclipse IDE and set up the SDK and other pieces of software needed. This wasn't difficult, but Android Studio eliminates extra steps and it makes programming Android easy. Put simply, it is the way of the future and so worth your investment in learning it.
With the release of Android Studio Google stopped work on the Eclipse plugin and this means that Android Studio really is the only way to develop apps from now on.
The Language Choice
With the soon to be released Android Studio 3 you now have a choice of programming in Java or Kotlin. The advantage of Java is that it is a well known and well supported language. Kotlin may be a be a new language, but it is well supported for the simple reason that it is 100% compatible with Java. The Android libraries are all written in Java but Kotlin can make use of them with no problems. It is this that makes Kotlin Android development possible. What is more you aren’t restricted to Kotlin in a project. You can add Java code and you can add Kotlin code to any existing Java projects you want to maintain.
Put simply there is very little risk involved in moving to Kotlin and there is a lot to be gained. Kotlin is a much simpler and cleaner language than Java. It has had the benefit of seeing how Java evolved and avoiding those mistakes. Kotlin attempts to get straight to the point. In Java you tend to write some code over and over and it can be time consuming and hides the simplicity of what you are trying to do. When ever this happens Kotlin modifies the language so that you can express what you are doing succinctly. Programmers moving from Java to Kotlin generally find that they like it because they get more done with less typing. Programmers who only know Kotlin don’t know how lucky they are!
Kotlin does things differently from Java and while you can pick up the language as you go you might like to read The Programmers Guide to Kotling. It isn’t necessary, as long as you know Java or another object oriented language, you can pick up Kotlin as you develop your Android apps but I recommend learning the finer points of the language sooner or later. It pays off to know your language.
The bottom line is that, unless you have a commitment to Java you probably should start new projects in Kotlin and convert existing projects to Kotlin a bit at a time.
What You Need to Know
You need to be able to program in a modern object-oriented language. Java would be best as it is closest to Kotlin but C++, C#, Visual Basic or anything similar are close enough in spirit to Java for you to be able to cope. You might well need to look things up about the specifics of particular features of Kotlin, but most of the time it should be obvious, or obvious with the help of a few comments.
It isn't necessary to be an expert programmer because for a lot of Android programming you are simply using the features and facilities provided. That is, a lot of Android programming is just a matter of following the rules.
However, if you hope to produce something unique and useful you will at some point have to add something of your own – and here creativity and skill are required. So you might not need to be an expert programmer to get started, but you need to become one by the time you create your amazing app.
Fortunately practice is a good teacher and so learning to make the most of Android Studio will actually help you learn to code.
Making a Start
As Android Studio 3 is in beta you currently have to download a zip which you simply unzip into a suitable directory. The detailed instructions are on the Preview page of the Android Studio web site.
When you first run Android Studio 3 (open studio64.exe or studio32.exe in the bin directory under Windows or studio.sh in bin under Linux). It will download a lot of files and install the SDK, emulator and tools. This can take some time. Are given an opportunity to customize the installation but in most cases it is better to accept the defaults.
The installer will download everything you need including the JDK
You can opt to start Android Studio after the installation. You will probably not get straight to Android Studio the first time it starts as it downloads updates to itself and to the Android SDK. You just have to be patient.
When it finally gets going you will see the Android Studio welcome screen: