BSc (Hons) in Information Technology
Year 2
                       IT2010 - Mobile Application Development
                                            Lab Sheet 01 Semester 2, 2021
Android Studio is the official Integrated Development Environment (IDE) for Android
app development, based on IntelliJ IDEA . On top of IntelliJ's powerful code editor and
developer tools, Android Studio offers even more features that enhance your productivity
when building Android apps.
   1. Start a new Android Studio project.
       Click on ‘Start a new Android Studio project’. You will be moved on to a screen that
       asks additional details of the project.
   2. Selecting a preloaded Activity screen.
       In this section of the project configuration, select an Activity to be preloaded.
       Activity can be defined as a page on the Android app. Like how websites have different
       pages, Android apps have Activities. Each activity has two files, the XML (.xml) file
       to design how it looks and the Java (.java) file to write code in that activity. By selecting
       an empty activity, all other activities can be included. This is why all our projects will
       start with an empty activity.
                                                                                                  1
                          BSc (Hons) in Information Technology
                                           Year 2
                   IT2010 - Mobile Application Development
                                         Lab Sheet 01 Semester 2, 2021
   Select the Empty Activity and proceed.
3. Give the application name under the ‘Application name:’ and select the target
   Android Devices screen.
   After given name to your Android application, here we are adjusting the settings of the
   devices our Android app will run on. For each major update of the Android OS, the API
   level is incremented. Having a lower API level will target a higher number of devices.
   Older version of Android studio application, after the given target Android devices
   screen, you need to customize the selected activity.
   Here we are describing the activity we have selected. Android Studio will provide default
   values [Activity Name: MainActivity] and [Layout Name: activity_main].
   Make sure to check the two options [Generate Layout File and Backwards Compatibility
   (AppCompat)].
   In the latest version of Android studio “Version 4.1.2” you don’t need to select it.
                                                                                               2
                           BSc (Hons) in Information Technology
                                            Year 2
                     IT2010 - Mobile Application Development
                                                Lab Sheet 01        Semester 2, 2021
When you click Finish, Android Studio will start building your app. Once all processes
are finished, you’ll get the Android Studio Interface.
   4. Android Studio Interface
                                                                                         3
                         BSc (Hons) in Information Technology
                                          Year 2
                  IT2010 - Mobile Application Development
                                                  Lab Sheet 01          Semester 2, 2021
   Palette has all the elements to design an application. All buttons, text fields, textviews,
   imageviews and many more things are available here.
   Click on the run button and that will take us to an AVD manager. Here, we have to set
   up our virtual device.
5. Set up a Virtual Device in Android Studio
   A virtual device is some space in the memory that functions as a phone. We can have
   multiple virtual devices with different versions of Android OS running on it. This is
   helpful when testing your app for backward compatibility. Multiple devices can be used
   to debug instant messaging applications.
   Click on ‘Create New Virtual Device’ and Android Studio will give you a lot more
   options to configure your Virtual Device.
   AVD name is simply the name given to your virtual device. You can just let it be
   what it is, or give it a name to remember your configuration.
   You also have to select the device to run the app on.
   Let the remaining options be set to default and click on finish.
                                                                                            4
                     BSc (Hons) in Information Technology
                                      Year 2
               IT2010 - Mobile Application Development
                                             Lab Sheet 01         Semester 2, 2021
Now you have a virtual device set up and can use it to run the app. Once everything is
set, Android Studio will take about a minute and then launch your virtual device. If it
doesn’t already launch your App, click the run button again and this time the emulator
will launch the app.
                                                                                     5
                         BSc (Hons) in Information Technology
                                          Year 2
                    IT2010 - Mobile Application Development
                                                  Lab Sheet 01         Semester 2, 2021
6. Java Folder
   Expand your project folder on left side folder structure and find the java folder. It
   contains the java code of your application.
   Open MainActivity.java file.
   You can add new activities for your project here.
                                               →         →
   Right click on your MainActivity.java file       New     Activity
   This will add a new java file as well as the interface connected with this java file.
7. User Interface
   Find the layout folder inside src folder.
                                                                                           6
                     BSc (Hons) in Information Technology
                                      Year 2
               IT2010 - Mobile Application Development
                                             Lab Sheet 01          Semester 2, 2021
This folder contains the user interfaces of your application. Initially it has the
activity_main.xml file which is connected with the MainActivity.java file.
Once you open this xml file you will be able to see the interface on screen. You can
edit this screen using the design view and text view.
In design view you can drag and drop anything from the pallet.
Use the properties to do modifications to added items on screen.
If select code tab at the top right corner of the mobile interface, your screen will be
switched to the xml view of your user interface. Spilt view gives both code and UI view
in the Android studio interface.
                                                                                     7
                             BSc (Hons) in Information Technology
                                              Year 2
                      IT2010 - Mobile Application Development
                                           Lab Sheet 01                   Semester 2, 2021
       You can edit your interface from this xml view as well.
Other important files in your project
              AndroidManifest.xml: Every application must have an AndroidManifest.xml
              file (with precisely that name) in its root directory. The manifest file presents
              essential information about your app to the Android system, information the
              system must have before it can run any of the app's code.
              drawable: Stores all the graphic files in your application.
Exercise
       Develop a mobile application that will display your registration number, name and
       batch name on screen. Use three separate texts to make this application.
       Note: Click the run button to run your application using the built AVD.
       Change the properties (color, size etc) of the texts and background of the interface.