Tuesday, October 2, 2018

Android Studio Tutorial – Hello World App


We’ll go with the New Project option here. However, you can choose Import Project if you’d like to import a project from, for example, Eclipse, into Android Studio. Android Studio will convert the Eclipse project to an Android Studio project, adding the necessary configuration files for you.
If you select Open Project from the list of options, you can open projects created either from the list of recent projects or by browsing the file system.


Android Studio Tutorial – New Project

Let’s create a new project using the wizard shown in the Quick Start section of the welcome screen. Enter some name for the application, let’s say “Hello World” and make sure your package name is unique.
If you own some domain say yourdomain.com, then your package could be com.yourdomain.app_name. While uniqueness isn’t of concern here, it will be important for an application that needs to be published to play store. Google Play Store distinguishes apps by the package name only.
android studio tutorial create new project
Click “Next” button again and you’ll be presented with a list of platforms where you want your application to run along with separate SDKs list since different platforms require different SDKs list.
android studio new project sdk selection
On the next screen you’ll be presented with a list of activity types. The default Blank Activity is good enough for this project.
android studio tutorial select activity
Click Next. This screen is an Activity configuration screen. Since you asked ADT to create an activity for you, this screen helps you in configuring relevant options.
android studio project customize activity
  1. Activity Name: Let’s stay with the default name MainActivity.
  2. Layout Name: ADT that creates activity for you, will also create a layout for you to bind it with the activity.
  3. Title: It specifies the title of the activity.
  4. Menu name: This is used to provide menu options. Keep default name only.
Click finish and wait for a few seconds for Gradle to do its magic.
Gradle is an advanced build toolkit that manages dependencies and allows you to define custom build logic. Android Studio uses a Gradle wrapper to fully integrate the Android plugin for Gradle.
The Android plugin for Gradle also runs independent of Android Studio. This means that you can build your Android apps from within Android Studio or from the command line on your machine or on machines where Android Studio is not installed.
android studio gradle build
Once you click Finish ADT will create your new project and will open Java code and Layout code for you.
android studio hello world project layout
By now you might be wondering how do you change your default white theme to the dark theme shown in the snippets. Go to menu Android Studio > Preferences, choose IDE Settings > Appearance.  Change the ‘Theme’ from ‘Default’ to ‘Dracula’.
android studio dracula theme settings

No comments:

Post a Comment