Android is a software platform and operating system for mobile devices based on the Linux operating system and developed by Google and the Open Handset Alliance. It allows developers to write managed code in a Java-like language that utilizes Google-developed Java libraries, but does not support programs developed in native code. The unveiling of the Android platform on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of 34 hardware, software and telecom companies devoted to advancing open standards for mobile devices. When released in 2008, most of the Android platform will be made available under the Apache free-software and open-source license.
Block diagram reduction techniques in control systems.ppt
Android App Development Project in College
1. A
Practical Training Seminar Report
On
“Android App Development”
Submitted for the partial fulfillment
Of the degree of
BACHELOR OF TECHNOLOGY
In Computer Science & Technology
2. Submitted By: Submitted To:
Prabhakar Alok Ms. Tarunpreet Chawla
13EVJCS038 (Asst. Professor, CSE Dept.)
Department of Computer Science & Engineering
Vivekananda Institute of Technology, Jaipur
Rajasthan Technical University
Kota (Rajasthan)
2016-17
3. CERTIFICATE
Hewlett Packard
Enterprise India Pvt
Ltd.
Building No:02, DLF
CYBERGREEN
1st, 4th & 5th Floor,
Tower D & E
DLF Cyber City, Phase
III
Gurgaon - 122 002
Haryana, India
Issue Date : 02-Jul-2016
To Whom So Ever It May Concern
This is to certify that project entitled Music Player(MP), designed on Core Java With Android
technology is an original work carried out by B.Tech student Mr. Prabhakar Alok, Enrollment ID
HPER-3756, of Vivekananda Institute of Technology, Jaipur from 20-May-2016 to 02-Jul-2016 at
HPE Nodal Training Centre,Patna.
The matter embodied in this project is a genuine work done by the student and has not been
submitted to the university or to any other university/institute for the fulfillment of the
requirement of any course of study.
Hope you have found all the above details in order.
Thanking You.
For Hewlett Packard Enterprise
5. DECLARATION
I hereby declare that this Practical Training seminar report on “Core Java with Android”
has not formed the basis of award of any previous degree or diploma etc. of this or any
other university. Further it is also stated that it is a record of study and no portion of this
report has been copied from any sources in any form. The formulation and other reference
material have been taken from the references as mentioned in the report.
It is certified that the comments given by industry have been suitably incorporated
(under the advice of my supervisor) in this report.
Date: Signature: …………………
Place: Jaipur Prabhakar Alok
13EVJCS038
Vivekananda Institute of Technology
Jaipur
Android App Development ii
6. ACKNOWLEDGEMENT
This PTS Seminar would not have been possible without the kind support and help of
many individuals. I would like to extend my sincere thanks to all of them. I would like
to express my gratitude towards Ms. Tarannum Sheikh (HOD, CSE Dept.) and PTS
Guide Ms. Tarunpreet Chawla (Asst. Professor, CSE Dept.) for their kind co-
operation and encouragement which help me in this practical training seminar.
I would like to express my special gratitude and thanks to the whole CSE
Department for giving me their attention and time, and clearing all my doubts and
queries. My thanks and appreciations also go to everyone who helped me in learning
process and have willingly helped me out with their abilities. I would even like to thank
my parents and friends to support me throughout this internship period.
I perceive this opportunity as a big milestone in my career development. I will strive
to use gained skills and knowledge in the best possible way, and I will continue to work
on their improvement, in order to attain desired career objectives. Hope to continue
cooperation with all of you in the future.
Signature: …………………
Date:
Place: Jaipur Prabhakar Alok
13EVJCS038
Vivekananda Institute of Technology
Jaipur
Android App Development I
i
8. ABSTRACT
I picked Android App development for my summer training. Android is a software stack
for mobile devices that includes an operating system, middleware and key applications.
Android is a software platform and operating system for mobile devices based on
the Linux operating system and developed by Google and the Open Handset Alliance. It
allows developers to write managed code in a Java-like language that utilizes Google-
developed Java libraries, but does not support programs developed in native code. The
unveiling of the Android platform on 5 November 2007 was announced with the founding
of the Open Handset Alliance, a consortium of 34 hardware, software and telecom
companies devoted to advancing open standards for mobile devices. When released in
2008, most of the Android platform will be made available under the Apache free-
software and open-source license.
Android App Development iv
9. CONTENTS
S. No. Title
Pa
ge
a. Certificate i
b. Declaration ii
c. Acknowledgement iii
d. Abstract iv
CHAPTER 1: INTRODUCTION 3
1.1 Overview 3
1.2 What is android 3
1.3 Why android? 4
CHAPTER 2: FEATURES 5
2.1 Feature Table 5
CHAPTER 3: ANDROID ARCHITECTURE 7
3.1 Categories of Android apps 7
3.2 What is an API level? 8
3.3 Set-up JDK
1
0
3.4 Android And its Kernel
1
1
3.4.1 Linux Kernel
1
2
3.5 Android Libraries
1
3
3.5.1 Libraries
1
3
3.6 Android Runtime
3.7 Android Framework
CHAPTER 4: ANDROID APP COMPONENTS 14
4.1 Activities 14
4.2 Services 15
4.3 Broadcast Receivers 15
4.4 Content Providers 16
4.5 Additional Components 16
4.6 Anatomy of Android App 17
4.6
.1 Main Activity file 18
10. 4.6
.2 Manifest file 19
4.6
.3 String file 21
4.6
.4 R file 22
4.6
.5 Layout file 24
CHAPTER 5: ANDROID LIFE CYCLE 26
Android App Development 1
5.1 Android Life Cycle and Diagram 26
CHAPTER 6: PROJECT DESCRIPTION 28
6.1 Introduction 28
6.2 Activites in App 28
6.3 Layouts in App 29
6.4 Firebase 29
6.5 Async Task 29
6.6 Shared Preference 30
6.7 Content Provider 30
6.8 Broadcast Receiver 30
6.9 Screenshots of App 31
6.10 Softwares and Tools used 33
CHAPTER 7: CONCLUSION 34
CHAPTER 8: REFERENCES 35
12. CHAPTER 1
INTRODUCTION
1.1 Overview
Android is a mobile operating system developed by Google, based on the
Linux kernel and designed primarily for touchscreen mobile devices such as
smartphones and tablets. Android's user interface is mainly based on direct
manipulation, using touch gestures that loosely correspond to real-world actions, such as
swiping, tapping and pinching, to manipulate on-screen objects, along with a virtual
keyboard for text input. In addition to touchscreen devices, Google has further developed
Android TV for televisions, Android Auto for cars, and Android Wear for wrist watches,
each with a specialized user interface. Variants of Android are also used on notebooks,
game consoles, digital cameras, and other electronics..
This will teach you basic Android programming and will also take you through some
advance concepts related to Android application development.
Android provides a rich application framework that allows you to build innovative apps
and games for mobile devices in a Java language environment. The documents listed in
the left navigation provide details about how to build apps using Android's various APIs.
If you're new to Android development, it's important that you understand the following
fundamental concepts about the Android app framework:
1.2 What is Android
Android is an open source and Linux-based Operating System for mobile devices
such as smartphones and tablet computers. Android was developed by the Open Handset
Alliance, led by Google, and other companies.
Android offers a unified approach to application development for mobile devices which
means developers need only develop for Android, and their applications should be able
to run on different devices powered by Android.
Android App Development 3
13. The first beta version of the Android Software Development Kit (SDK) was released by
Google in 2007 where as the first commercial version, Android 1.0, was released in
September 2008.
On June 27, 2012, at the Google I/O conference, Google announced the next Android
version, 4.1 Jelly Bean. Jelly Bean is an incremental update, with the primary aim of
improving the user interface, both in terms of functionality and performance.
The source code for Android is available under free and open source software licenses.
Google publishes most of the code under the Apache License version 2.0 and the rest,
Linux kernel changes, under the GNU General Public License version 2.
1.3 Why Android
Completely customizable, ability to choose default apps.
Google Now (personal phone assistant)
Selection and variety and affordable price range
Material Design
Android App Development 4
14. CHAPTER 2
FEATURES
Android is a powerful operating system competing with Apple 4GS and supports great
features. Few of them are listed below:
2.1 Feature Table
Feature Description
Beautiful UI Android OS basic screen provides a beautiful and intuitive user
interface.
Connectivity GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE,
NFC and WiMAX.
Storage SQLite, a lightweight relational database, is used for data storage
purposes.
Media support H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC
5.1, MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP
Messaging SMS and MMS
Web browser Based on the open-source WebKit layout engine, coupled with
Chrome's V8 JavaScript engine supporting HTML5 and CSS3.
Android App Development 5
15. Multi-touch Android has native support for multi-touch which was initially made
available in handsets such as the HTC Hero.
Multi-tasking User can jump from one task to another and same time various
application can run simultaneously.
Resizable
widgets Widgets are resizable, so users can expand them to show more content
or shrink them to save space
Multi-Language Supports single direction and bi-directional text.
GCM Google Cloud Messaging (GCM) is a service that lets developers send
short message data to their users on Android devices, without needing
a proprietary sync solution.
Wi-Fi Direct A technology that lets apps discover and pair directly, over a high-
bandwidth peer-to-peer connection.
Android Beam
A popular NFC-based technology that lets users instantly share, just
by
touching two NFC-enabled phones together.
Android App Development 6
16. CHAPTER 3
Android Architecture
Android applications are usually developed in the Java language using the Android
Software Development Kit.
Once developed, Android applications can be packaged easily and sold out either through
a store such as Google Play ,Slide ME, Opera Mobile Store, Mobango, F-droid and the
Amazon App store.
Android powers hundreds of millions of mobile devices in more than 190 countries
around the world. It's the largest installed base of any mobile platform and growing fast.
Every day more than 1 million new Android devices are activated worldwide.
This tutorial has been written with an aim to teach you how to develop and package
Android application. We will start from environment setup for Android application
programming and then drill down to look into various aspects of Android applications.
3.1 Categories of Android applications
There are many android applications in the market. The top categories are:
History of Android
The code names of android ranges from A to L currently, such as Aestro, Blender,
Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch, Jelly
Bean, KitKat and Lollipop. Let's understand the android history in a sequence.
Android App Development 7
17. 3.2 What is API level?
API Level is an integer value that uniquely identifies the framework API revision offered
by a version of the Android platform.
Platform Version API VERSION_CODE
Level
Android 5.1 22 LOLLIPOP_MR1
Android 5.0 21 LOLLIPOP
Android 4.4W 20 KITKAT_WATCH KitKat for
Wearables Only
Android 4.4 19 KITKAT
Android 4.3 18 JELLY_BEAN_MR2
Android 4.2, 4.2.2 17 JELLY_BEAN_MR1
Android 4.1, 4.1.1 16 JELLY_BEAN
Android 4.0.3, 15
ICE_CREAM_SANDWICH_MR
1
4.0.4
Android 4.0,
4.0.1, 14 ICE_CREAM_SANDWICH
4.0.2
Android 3.2 13 HONEYCOMB_MR2
18. Android App Development 8
Android 3.1.x 12 HONEYCOMB_MR1
Android 3.0.x 11 HONEYCOMB
Android 2.3.4 10 GINGERBREAD_MR1
Android 2.3.3
Android 2.3.2 9 GINGERBREAD
Android 2.3.1
Android 2.3
Android 2.2.x 8 FROYO
Android 2.1.x 7 ECLAIR_MR1
Android 2.0.1 6 ECLAIR_0_1
Android 2.0 5 ÉCLAIR
Android 1.6 4 DONUT
Android 1.5 3 CUPCAKE
Android 1.1 2 BASE_1_1
Android 1.0 1 BASE
You will be glad to know that you can start your Android application development on
either of the following operating systems −
Microsoft Windows XP or later version.
Mac OS X 10.5.8 or later version with Intel chip.
Android App Development 9
19. • Linux including GNU C Library 2.7 or later.
Second point is that all the required tools to develop Android applications are freely
available and can be downloaded from the Web. Following is the list of software's you
will need before you start your Android application programming.
Java JDK5 or later version
Android SDK
Java Runtime Environment (JRE) 6
Android Studio
Eclipse IDE for Java Developers (optional)
Android Development Tools (ADT) Eclipse Plug-in (optional)
Here last two components are optional and if you are working on Windows machine then
these components make your life easy while doing Java based application development.
So let us have a look how to proceed to set required environment.
3.3 Set-up Java Development Kit (JDK)
You can download the latest version of Java JDK from Oracle's Java site: Java SE
Downloads. You will find instructions for installing JDK in downloaded files, follow the
given instructions to install and configure the setup. Finally set PATH and JAVA_HOME
environment variables to refer to the directory that containsjava and javac, typically
java_install_dir/bin and java_install_dir respectively.
If you are running Windows and installed the JDK in C:jdk1.6.0_15, you would have to
put the following line in your C:autoexec.bat file.
set PATH=C:jdk1.7.0_75bin;%PATH%
set JAVA_HOME=C:jdk1.7.0_75
Alternatively, you could also right-click on My Computer, select Properties,
thenAdvanced, then Environment Variables. Then, you would update the PATH value
and press the OK button.
Android App Development 10
20. On Linux, if the SDK is installed in /usr/local/jdk1.6.0_15 and you use the C shell, you
would put the following code into your .cshrc file.
setenv PATH /usr/local/jdk1.7.0_75/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.7.0_75
Alternatively, if you use an Integrated Development Environment (IDE) Eclipse, then it
will know automatically where you have installed your Java.
3.3.1 Android IDEs
There are so many sophisticated Technologies are available to develop android
applications, the familiar technologies, which are predominantly using tools as follows
Android Studio
Eclipse IDE
3.4 Android and its Kernel
Android operating system is a stack of software components which is roughly divided
into five3.3 sections and four main layers as shown below in the architecture diagram.
21. 3.4.1 Linux kernel
At the bottom of the layers is Linux - Linux 3.6 with approximately 115 patches. This
provides a level of abstraction between the device hardware and it contains all the essential
Android App Development 11
22. hardware drivers like camera, keypad, display etc. Also, the kernel handles all the things
that Linux is really good at such as networking and a vast array of device drivers, which
take the pain out of interfacing to peripheral hardware.
3.5 Android Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser
engine WebKit, well known library libc, SQLite database which is a useful repository for
storage and sharing of application data, libraries to play and record audio and video, SSL
libraries responsible for Internet security etc.
3.5.1 Libraries
This category encompasses those Java-based libraries that are specific to Android
development. Examples of libraries in this category include the application framework
libraries in addition to those that facilitate user interface building, graphics drawing and
database access. A summary of some key core Android libraries available to the Android
developer is as follows −
android.app − Provides access to the application model and is the cornerstone of
all Android applications.
android.content − Facilitates content access, publishing and messaging between
applications and application components.
android.database − Used to access data published by content providers and includes
SQLite database management classes.
android.opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
android.os − Provides applications with access to standard operating system
services including messages, system services and inter-process communication.
android.text − Used to render and manipulate text on a device display.
android.view − The fundamental building blocks of application user interfaces.
android.widget − A rich collection of pre-built user interface components such as
buttons, labels, list views, layout managers, radio buttons etc.
Android App Development 12
23. android.webkit − A set of classes intended to allow web-browsing capabilities to
be built into applications.
Having covered the Java-based core libraries in the Android runtime, it is now time to
turn our attention to the C/C++ based libraries contained in this layer of the Android
software stack.
3.6 Android Runtime
This is the third section of the architecture and available on the second layer from the
bottom. This section provides a key component called Dalvik Virtual Machine which is a
kind of Java Virtual Machine specially designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and multi-
threading, which is intrinsic in the Java language. The Dalvik VM enables every Android
application to run in its own process, with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android application
developers to write Android applications using standard Java programming language.
3.7 Application Framework
The Application Framework layer provides many higher-level services to applications in
the form of Java classes. Application developers are allowed to make use of these
services in their applications.
The Android framework includes the following key services −
Activity Manager − Controls all aspects of the application lifecycle and activity
stack.
Content Providers − Allows applications to publish and share data with other
applications.
Resource Manager − Provides access to non-code embedded resources such as
strings, color settings and user interface layouts.
Notifications Manager − Allows applications to display alerts and notifications to
the user.
Android App Development 13
24. CHAPTER 4
Android App Components
Application components are the essential building blocks of an Android application. These
components are loosely coupled by the application manifest file AndroidManifest.xml that
describes each component of the application and how they interact.
There are following four main components that can be used within an Android application:
Components Description
Activities
They dictate the UI and handle the user interaction to the smart
phone
screen
Services They handle background processing associated with an application.
Broadcast
Receivers
They handle communication between Android OS and
applications.
Content Providers They handle data and database management issues.
4.1 Activities
An activity represents a single screen with a user interface,in-short Activity performs
actions on the screen. For example, an email application might have one activity that
shows a list of new emails, another activity to compose an email, and another activity for
reading emails. If an application has more than one activity, then one of them should be
marked as the activity that is presented when the application is launched.
An activity is implemented as a subclass of Activity class as follows –
Android App Development 14
25.
26. public class MainActivity extends Activity {
}
4.2 Services
A service is a component that runs in the background to perform long-running
operations. For example, a service might play music in the background while the user is
in a different application, or it might fetch data over the network without blocking user
interaction with an activity.
A service is implemented as a subclass of Service class as follows −
public class MyService extends Service {
}
4.3 Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or
from the system. For example, applications can also initiate broadcasts to let other
applications know that some data has been downloaded to the device and is available for
them to use, so this is broadcast receiver who will intercept this communication and will
initiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiverclass and each
message is broadcaster as an Intent object.
public class MyReceiver extends BroadcastReceiver {
public void onReceive(context,intent){}
Android App Development 15
27. }
4.4 Content Providers
A content provider component supplies data from one application to others on request.
Such requests are handled by the methods of the ContentResolverclass. The data may be
stored in the file system, the database or somewhere else entirely.
A content provider is implemented as a subclass of ContentProvider class and must
implement a standard set of APIs that enable other applications to perform transactions.
public class MyContentProvider extends ContentProvider {
public void onCreate(){}
}
We will go through these tags in detail while covering application components in
individual chapters.
4.5 Additional Components
There are additional components which will be used in the construction of above
mentioned entities, their logic, and wiring between them. These components are –
Components Description
28. Fragments Represents a portion of user interface in an Activity.
Android App Development 16
Views UI elements that are drawn on-screen including buttons, lists forms etc.
Layouts
View hierarchies that control screen format and appearance of the
views.
Intents Messages wiring components together.
Resources External elements, such as strings, constants and drawable pictures.
Manifest Configuration file for the application.
4.6 Anatomy of Android Application
Before you run your app, you should be aware of a few directories and files in the
Android project −
S.
N. Folder, File & Description
1 src
This contains the .java source files for your project. By default, it includes
a MainActivity.java source file having an activity class that runs when your app is
launched using the app icon.
2 Gen
This contains the .R file, a compiler-generated file that references all the resources
found in your project. You should not modify this file.
29. 3 Bin
Android App Development 17
This folder contains the Android package files .apk built by the ADT during the
build process and everything else needed to run an Android application.
4 res/drawable-hdpi
This is a directory for drawable objects that are designed for high-density screens.
5 res/layout
This is a directory for files that define your app's user interface.
6 res/values
This is a directory for other various XML files that contain a collection of
resources,
such as strings and colours definitions.
7 AndroidManifest.xml
This is the manifest file which describes the fundamental characteristics of the app
and defines each of its components.
4.6.1 The Main Activity File
The main activity code is a Java file MainActivity.java. This is the actual application file
which ultimately gets converted to a Dalvik executable and runs your application.
Following is the default code generated by the application wizard for Hello World!
application −
package com.example.helloworld;
import android.os.Bundle;
31. import android.support.v4.app.NavUtils;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Here, R.layout.activity_main refers to the activity_main.xml file located in theres/layout
folder. The onCreate() method is one of many methods that are figured when an activity
is loaded.
4.6.2 The Manifest File
Whatever component you develop as a part of your application, you must declare all its
components in a manifest.xml which resides at the root of the application project
directory. This file works as an interface between Android OS and your application, so if
you do not declare your component in this file, then it will not be considered by the OS.
For example, a default manifest file will look like as following file −
Android App Development 19
33. </application>
</manifest>
Here <application>...</application> tags enclosed the components related to the
application. Attribute android:icon will point to the application icon available under
res/drawable-hdpi. The application uses the image named ic_launcher.png located in the
drawable folders
The <activity> tag is used to specify an activity and android:name attribute specifies the
fully qualified class name of the Activity subclass and theandroid:label attributes
specifies a string to use as the label for the activity. You can specify multiple activities
using <activity> tags.
The action for the intent filter is named android.intent.action.MAIN to indicate that this
activity serves as the entry point for the application. The category for the intent-filter is
named android.intent.category.LAUNCHER to indicate that the application can be
launched from the device's launcher icon.
The @string refers to the strings.xml file explained below.
Hence,@string/app_name refers to the app_name string defined in the strings.xml file,
which is "HelloWorld". Similar way, other strings get populated in the application.
Following is the list of tags which you will use in your manifest file to specify different
Android application components:
<activity>elements for activities
<service> elements for services
<receiver> elements for broadcast receivers
<provider> elements for content providers
4.6.3 The Strings File
The strings.xml file is located in the res/values folder and it contains all the text that your
application uses. For example, the names of buttons, labels, default text, and similar types
Android App Development 21
34. of strings go into this file. This file is responsible for their textual content. For example,
a default strings file will look like as following file −
<resources>
<string name="app_name">HelloWorld</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main">MainActivity</string>
</resources>
4.6.4 The R File
The gen/com.example.helloworld/R.java file is the glue between the activity Java files like
MainActivity.java and the resources like strings.xml. It is an automatically generated file and
you should not modify the content of the R.java file. Following is a sample of
R.java file −
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.helloworld;
public final class R {
public static final class attr {
Android App Development 22
35. }
public static final class dimen {
public static final int padding_large=0x7f040002;
public static final int padding_medium=0x7f040001;
public static final int padding_small=0x7f040000;
}
public static final class drawable {
public static final int ic_action_search=0x7f020000;
public static final int ic_launcher=0x7f020001;
}
public static final class id {
public static final int menu_settings=0x7f080000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int activity_main=0x7f070000;
}
36. public static final class string {
public static final int app_name=0x7f050000;
public static final int hello_world=0x7f050001;
public static final int menu_settings=0x7f050002;
public static final int title_activity_main=0x7f050003;
}
public static final class style {
public static final int AppTheme=0x7f060000;
}
}
4.6.5 The Layout File
The activity_main.xml is a layout file available in res/layout directory, that is referenced
by your application when building its interface. You will modify this file very frequently
to change the layout of your application. For your "Hello World!" application, this file
will have following content related to default layout −
<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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Android App Development 24
38. CHAPTER 5
ACTIVITY LIFE CYCLE
5.1 Activity Life Cycle and Diagram
If you have worked with C, C++ or Java programming language then you must have seen
that your program starts from main() function. Very similar way, Android system initiates
its program with in an Activity starting with a call ononCreate() callback method. There
is a sequence of callback methods that start up an activity and a sequence of callback
methods that tear down an activity as shown in the below Activity life cycle diagram:
(image courtesy : android.com )
The Activity class defines the following call backs i.e. events. You don't need to
implement all the callbacks methods. However, it's important that you understand each
one and implement those that ensure your app behaves the way users expect.
Android App Development 26
40. onCreate() This is the first callback and called when the activity is first created.
onStart() This callback is called when the activity becomes visible to the user.
onResume() This is called when the user starts interacting with the application.
onPause() The paused activity does not receive user input and cannot execute any
code and called when the current activity is being paused and the
previous
activity is being resumed.
onStop() This callback is called when the activity is no longer visible.
onDestroy() This callback is called before the activity is destroyed by the system.
onRestart() This callback is called when the activity restarts after stopping it.
Android App Development 27
41. CHAPTER 6
PROJECT DESCRIPTION
6.1 Introduction
I’ve created an android app as my training project, whose name is “eNEWS”.As the name
suggests this app will provide you news from newspapers that you’ve chosen earlier. So
basically what we have tried to do here is that we’ve created and online news portal
through which you can access all the newspapers for free without even paying a single
penny for subscription , All you have to do is that you sign up for the app or if you are
already a registered then just sign in and choose your preferences like Language ,Country
, State , and City etc , When you’ll filled up all that information and according to your
filled up information this app will show you a set of news papers , you can click any of
them and here you go.. you are now able to access all the newspapers you’ve wanted .
“eNEWS” Application is consists of many Activities and I’ve also written layout for
each activity. All the Activities are written in Core Java Language and all the Layout files
are written in Xml which is a markup language. Also I’ve used RSS Handler to handle the
RSS that I am fetching from all the other newspapers and this Handler will also redirect
them to one appropriate newspaper when needed button will be clicked.
For the database related purpose I’ve used FireBase which will store the usernames and
their password , so that when they sign in again only authenticated users will be able to
sign in their accounts.
6.2 Activities in App
AdapterHomapage
DetailHomepage
DetailPageAdapter
HomepageActivity
LoginActivity
Android App Development 28
42. SignupActivity
RSShandler
RSSitem
RSSreader
PreferenceAcitivty
6.3 Layouts in App
Activity_detailpage.xml
Activity_homepage.xml
Acitivty_login.xml
Acitivty_signup.xml
Activity_preference.xml
Activity_AdapterHomapage.xml
6.4 Firebase
Firebase is a cloud services provider and backend as a service company based in San
Francisco, California. The company makes a number of products for software developers
building mobile or web applications. Firebase was founded in 2011 by Andrew Lee and
James Tamplin and launched with a realtime cloud database in April 2012.
[6]
Firebase's
primary product is a realtime database which provides an API that allows developers to
store and sync data across multiple clients. The company was acquired by Googlein
October 2014.
6.5 Async Task
AsyncTask enables proper and easy use of the UI thread. This class allows you to
perform background operations and publish results on the UI thread without having to
manipulate threads and/or handlers.
AsyncTask is designed to be a helper class around Thread and Handler and does not
constitute a generic threading framework. AsyncTasks should ideally be used for short
operations (a few seconds at the most.) If you need to keep threads running for long
periods of time, it is highly recommended you use the various APIs provided by the
java.util.concurrent package such as Executor, ThreadPoolExecutor and FutureTask.
Android App Development 29
43. An asynchronous task is defined by a computation that runs on a background thread and
whose result is published on the UI thread. An asynchronous task is defined by 3 generic
types, called Params, Progress and Result, and 4 steps.
6.6 Shared Preference
Interface for accessing and modifying preference data returned
by getSharedPreferences(String, int). For any particular set of preferences, there is a
single instance of this class that all clients share. Modifications to the preferences must go
through an SharedPreferences.Editor object to ensure the preference values remain in a
consistent state and control when they are committed to storage. Objects that are returned
from the various getmethods must be treated as immutable by the application.
6.7 Content Providers
A content provider component supplies data from one application to others on request.
Such requests are handled by the methods of the ContentResolverclass. The data may be
stored in the file system, the database or somewhere else entirely.
A content provider is implemented as a subclass of ContentProvider class and must
implement a standard set of APIs that enable other applications to perform transactions.
6.8 Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or
from the system. For example, applications can also initiate broadcasts to let other
ssssinitiate appropriate action.
A broadcast receiver is implemented as a subclass of BroadcastReceiverclass and each
message is broadcaster as an Intent object.
Android App Development 30
47. Softwares , Tools and IDE used
Android Studio 2.0
Android SDK
Java JDK
Genymotion
FireBase
Android App Development 33
48. CHAPTER 7
CONCLUSION
I’ve successfully completed my summer training in Android App development , and also
I’ve created an Android App. It was a good experience for me because I actually got
training from the actual developers from the company. They were all very kind and
helpful. At the end of the training I got to learn very much about Android and its App
projects .The project completion was not an easy process however the presence of
experienced individuals around me made it a journey to remember. I started as someone
with minimal work experience, as an enthusiast who wanted to get into Android.
After the completion of the project, I am proud of to say that I am extremely happy with
the project outcome and have tremendous pride in the work before you.
This project is my first work in a professional organisation and I hope this works as a
stepping stone in my professional carrier and would propel me into future endeavours.
Android App Development 34