1
 Introduction.
 Download & Installation.
 Creating “Hello-World”.
 How to open projects.
 How to import projects.
 Checkout project from version control.
 Import an Android code sample.
 Anatomy Of Android Studio.
 Inside Java class.
2
For the past three years, android development has changed a lot by
migrating from eclipse to android studio which include
development for wearable and glass which is new thing in
development.
So it's time to start developing mobile applications , and to get
started with this you need to download and install Java
Development Kit (JDK) and Android Studio as well as the
Android Software Development Kit (SDK), which is a "suite of
software tools required to build Android apps."
3
 System Requirements:
4
You need to install JDK and then Android Studio.
JDK.
Android studio
Then click the green button to start downloading and by
following the dialogue instruction you will be almost
there.Once the installation is done, you have the ability to
create a project and say "Hello Wold !"
5
When the wizard has finished installation, then you need to launch android
studio
6
 By choosing "Start new Android Studio project" you will be able to create a new
project. Creating new project wizard will appear and you need to give your project a
name and a package name, start your package name with
com.yourCompany/business.projectname, then set project name, press next
7
As shown in figure below, in this wizard you will choose your
app type and the minimum sdk unlike the eclipse you don't need
to set the minimum sdk and the target sdk, the gradle will handle
this issue.Once you finish press next,
8
Now it's time to add an activity to your project if you want to run
a small to medium project with menu choose basic activity not
empty, this will save about 1-2 hours of working so yes we will
say hello world from basic activity.
press next ..
9
Here you will give your main activity a name or you can just leave
as it's, also you can check the box to add a fragment, if you have a
web development background and in my opinion it's just like a web
part that you will add it later to the master page.
10
Fragment:
In Android 3.0 (API Level 11), Android introduced the Fragments API. This was
in response to a growing need to accommodate multiple screen sizes (such as
tablets versus phones) and orientations (landscape versus portrait). To do this, it
was necessary to modularize the views (the UI) such that it would be easy to
separate the Activity container from the UI. This enables the developer to create a
more responsive and easy-to build interface to the user’s needs—such as
changing the interface on the fly rather than having to create completely new
containers for every configuration.
Now press finish.
11
This is the UI window that you will design
your project through. In left side pane from
the Project tool window you will find the java
file inside the package and you will find the UI
part under the layout because we have chosen the
basic activity and also from design pattern background
you will find two .xml files one
for the main activity (contains the menu and it's able to be customised)
and the content
will contain the design of the child/slave UI (mobile apps supports design pattern
so you don't need to build one).
Note:
to use a device you need to activate the developer
options in your device by clicking several times in
your phone
go to settings -> about device -> software info -> build number , press it several time press back to settings you
will find developer options.
Now you can press run with the emulator
(don't close the emulator after first time you run it) or by using a device . After initializing the Android bridge
(ADB) press create new emulator an then download package.
12
13
Choose option number two.
By choosing option number two, you will simply be able to open
an existing project just by choosing the project from the
directory like figure below :
Also, you can access your project from Git (like source control in
visual studio),GitHub,Google cloud and etc .. see figure below:
14
So you have developed a project with different IDE , you can import it by
choosing import project like figure below:
15
For learning purposes you can download a sample and read it by choosing Import
an Android code sample, like in figure below:
16
Android Studio is very powerful IDE (Integrated Development
Environment), it can be classified as windowed environment. You
need to be aware of each single function of each window in order to
get the advantages and benefits of Android Studio.
By using Android Studio you will be able to create Android
projects which may contain many packages, directories, and files ,
the productivity inside Android Studio will increase depending on
how flexible you are while navigating within these assets and
across them.
17
In figure below the Android IDE including numbers to each windows
and tabs followed by a table that will illustrate the description.
18
19
20
21
22
23
The entry point of your project is the onCreate function, it's like the main function in
Visual Studio.So , for example to access the TextView that hold the Hello Wold in the
previous post you need to the following :
1. Declare a variable of the same type of the user control that you want to access and
you need to assign the id in xml then in your code Globally out side the onCreate
function write
TextView tvHelloWorld;
Note that the user control is now null and it may cause null pointer exception (null
reference exception).
2. Now inside your onCreate java method you need to point to the control that you
have created in .xml file
tvHelloWorld = (TextView) findViewById(R.id.tvHelloWorldMessage); 3. Now the
global variable is not null and it's point to the UI that we have created. You can set
and get the text or any other property.
Note :
Android Studio is case sensitive if you declare a variable in lower case you should
type it in lower case and vice versa.
24
Code snippet:
25

Getting started with android studio

  • 1.
  • 2.
     Introduction.  Download& Installation.  Creating “Hello-World”.  How to open projects.  How to import projects.  Checkout project from version control.  Import an Android code sample.  Anatomy Of Android Studio.  Inside Java class. 2
  • 3.
    For the pastthree years, android development has changed a lot by migrating from eclipse to android studio which include development for wearable and glass which is new thing in development. So it's time to start developing mobile applications , and to get started with this you need to download and install Java Development Kit (JDK) and Android Studio as well as the Android Software Development Kit (SDK), which is a "suite of software tools required to build Android apps." 3
  • 4.
  • 5.
    You need toinstall JDK and then Android Studio. JDK. Android studio Then click the green button to start downloading and by following the dialogue instruction you will be almost there.Once the installation is done, you have the ability to create a project and say "Hello Wold !" 5
  • 6.
    When the wizardhas finished installation, then you need to launch android studio 6
  • 7.
     By choosing "Startnew Android Studio project" you will be able to create a new project. Creating new project wizard will appear and you need to give your project a name and a package name, start your package name with com.yourCompany/business.projectname, then set project name, press next 7
  • 8.
    As shown infigure below, in this wizard you will choose your app type and the minimum sdk unlike the eclipse you don't need to set the minimum sdk and the target sdk, the gradle will handle this issue.Once you finish press next, 8
  • 9.
    Now it's timeto add an activity to your project if you want to run a small to medium project with menu choose basic activity not empty, this will save about 1-2 hours of working so yes we will say hello world from basic activity. press next .. 9
  • 10.
    Here you willgive your main activity a name or you can just leave as it's, also you can check the box to add a fragment, if you have a web development background and in my opinion it's just like a web part that you will add it later to the master page. 10
  • 11.
    Fragment: In Android 3.0(API Level 11), Android introduced the Fragments API. This was in response to a growing need to accommodate multiple screen sizes (such as tablets versus phones) and orientations (landscape versus portrait). To do this, it was necessary to modularize the views (the UI) such that it would be easy to separate the Activity container from the UI. This enables the developer to create a more responsive and easy-to build interface to the user’s needs—such as changing the interface on the fly rather than having to create completely new containers for every configuration. Now press finish. 11
  • 12.
    This is theUI window that you will design your project through. In left side pane from the Project tool window you will find the java file inside the package and you will find the UI part under the layout because we have chosen the basic activity and also from design pattern background you will find two .xml files one for the main activity (contains the menu and it's able to be customised) and the content will contain the design of the child/slave UI (mobile apps supports design pattern so you don't need to build one). Note: to use a device you need to activate the developer options in your device by clicking several times in your phone go to settings -> about device -> software info -> build number , press it several time press back to settings you will find developer options. Now you can press run with the emulator (don't close the emulator after first time you run it) or by using a device . After initializing the Android bridge (ADB) press create new emulator an then download package. 12
  • 13.
    13 Choose option numbertwo. By choosing option number two, you will simply be able to open an existing project just by choosing the project from the directory like figure below :
  • 14.
    Also, you canaccess your project from Git (like source control in visual studio),GitHub,Google cloud and etc .. see figure below: 14
  • 15.
    So you havedeveloped a project with different IDE , you can import it by choosing import project like figure below: 15
  • 16.
    For learning purposesyou can download a sample and read it by choosing Import an Android code sample, like in figure below: 16
  • 17.
    Android Studio isvery powerful IDE (Integrated Development Environment), it can be classified as windowed environment. You need to be aware of each single function of each window in order to get the advantages and benefits of Android Studio. By using Android Studio you will be able to create Android projects which may contain many packages, directories, and files , the productivity inside Android Studio will increase depending on how flexible you are while navigating within these assets and across them. 17
  • 18.
    In figure belowthe Android IDE including numbers to each windows and tabs followed by a table that will illustrate the description. 18
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
    The entry pointof your project is the onCreate function, it's like the main function in Visual Studio.So , for example to access the TextView that hold the Hello Wold in the previous post you need to the following : 1. Declare a variable of the same type of the user control that you want to access and you need to assign the id in xml then in your code Globally out side the onCreate function write TextView tvHelloWorld; Note that the user control is now null and it may cause null pointer exception (null reference exception). 2. Now inside your onCreate java method you need to point to the control that you have created in .xml file tvHelloWorld = (TextView) findViewById(R.id.tvHelloWorldMessage); 3. Now the global variable is not null and it's point to the UI that we have created. You can set and get the text or any other property. Note : Android Studio is case sensitive if you declare a variable in lower case you should type it in lower case and vice versa. 24
  • 25.