http://www.raywenderlich.com/56107/make-first-android-app-part-1html
http://www.raywenderlich.com/56109/make-first-android-app-part-2java
http://www.raywenderlich.com/56111/make-first-android-app-part-3android
Activity
, but it certainly won’t be the last. In Android, an Activity
is usually thought of as a 「screen」 in your app. It could be fullscreen or it could be a partial-screen pop-up. It is very flexible. If you want your user interacting with something in your app, that’s at some level happening via an Activity
.
MainActivity
, what it’s doing is making a subclass of
Activity
. Those familiar with object-oriented programming will know what this is, but for newcomers, this basically means that your
MainActivity
is going to be a customized version of
Activity
that acts just like the default one, handling things like its lifecycle and the user interface display.
MainActivity
in Java, but the layout of everything it will show to the user is defined in a special sort of Android XML. You will learn how to read and edit those files soon.Every great team is composed of people who play different roles. Do you want to do the job right? You need the right team. Android Projects have a few key elements and each has a role to play:web
It’s the job of your Java code to get things done. Your code is all going to be in the src\main\java directory under your main project folder. I’ll give you all the code you need to complete this tutorial, but if you want to learn or refresh your Java knowledge, here is a nice online interactive tutorial.apache
It will be worth your time to learn more and more Java as you explore Android development. Your team is relying on the professional.app
It’s not enough to just get the job done. It needs to be done in style. Your app is never going to stand out unless it has great icons and images, well-designed layouts, engaging copy text, and maybe even some smooth animations.less
Initially, the src\main\res (Resources) folder contains:maven
Someone’s got to call the shots. That 「someone」 would be the Android manifest. This XML file informs your system of the app’s hardware and software requirements and contains your app’s name, icon, and version.ide
The manifest also filters the Intents
coming in. You need a job done by your app? Talk to the boss first. Now, more about the jobs themselves…flex
Want to show the user a screen? Want to navigate to a website? Whatever the job is, in Android it is going to take the form of an Intent
. If you come from an iOS background, pay close attention because this is a very 「Android」 concept.
The Android system knows that you will potentially have a lot of apps on your device, and wants to make it easy for them to talk to each other. So, it allows you to send and receive what are essentially requests for jobs to be done.
A job could get picked up by your app’s own boss (the manifest) or another app. When creating an Intent
, it’s up to you to either write it very generally to have the option of picking from several apps to perform the job (implicit), or very specifically to follow a certain path (explicit). You’ll see an example of each type if Intent
later in this tutorial.
For an immediate example, your app already has an Activity
called MainActivity
. Your manifest has it labeled with an intent filter that causes the MainActivity
to launch when the user selects the app icon from their home screen. You could potentially move that filter to another Activity
and then that activity would launch instead of MainActivity
. Basically, the app does whatever the boss says.
If you don’t fully grasp everything about Intents
right away, don’t worry. Just keep the concept in mind as you see Intents
throughout the code, and eventually you will start to get an idea of their potential.