Introduction to Android Studio

Android Studio is an interface development environment (IDE) to develop Android application on Linux, MS Windows and Mac OSX. This will provide developers with tools to compile the sources code, package it for deployment, code command completion, drag and drop, launch the compiled android application and much more.

Details of this project can be found at the developer site (link).

The current Android Studio SDK is at version 1.4 released in September 2015 (link). Recommended system requirements;

  • RAM 4GB
  • Disk space 500GB free
  • JDK version 7 ad above
  • Screen 1280x800
Install Intel HAXM and assign minimum 2GB RAM if using the Android emulator.

Here are steps to create a blank activity project in Android Studio.

Step 1: Create a new project.

Open Android Studio and choose;
"Start a new Adroid Studio project"


Application name: HelloWorld
Company Domain: xyz.example.com

This is case sensitive. Its practice for the application name to be in camelCase to match the classname.

Click Next


Phone and Tablet: Checked
Minimum SDK: API 14: Android 4.0 (IceCreamSandwich)

Click Next


Choose Blank Activity
Click Next


Identify the provided default names.
Click Next.
Wait for the project files to be generated.



Here is a listing of the default project files.


The activity_main.xml will contain;

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">


<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />


</RelativeLayout>


Step 2: Run the Android application

There are 2 ways to run your App;
  1. Use an Android emulator
  2. Plugin an Android phone
The length of time for the App to appear depends on the computer performance. Its taken me a good 20 minutes to startup on an i3 Intel CPU for some App. The Intel HAXM installation truly helps to speed up running of the Android emulator.

In this example, ensure you have already created an emulator for API 14. 

Click the Run 'App' button (or press Shift+F10). That the green triangle button.


Click Launch emulator, choose the Android virtual device name.

Click OK.

Extract course files from github. Command line type;

$ git clone -b 1.02_add_list_item_forecast_layout  https://github.com/udacity/Sunshine-Version-2.git

Reference:

  1. Google Developers, Get started in Android Studio
  2. -

Done

Blog Archive