BSC (Hons) in Information Technology Year 2: It2010 - Mobile Application Development
BSC (Hons) in Information Technology Year 2: It2010 - Mobile Application Development
Year 2
IT2010 - Mobile Application Development
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.
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
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
When you click Finish, Android Studio will start building your app. Once all processes
are finished, you’ll get the Android Studio Interface.
3
BSc (Hons) in Information Technology
Year 2
IT2010 - Mobile Application Development
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
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
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.
7. User Interface
6
BSc (Hons) in Information Technology
Year 2
IT2010 - Mobile Application Development
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.
7
BSc (Hons) in Information Technology
Year 2
IT2010 - Mobile Application Development
You can edit your interface from this xml view as well.
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.