Introduction to Android App Development
Android, developed by Google, is a popular mobile platform based on a modified version of Linux. It aims to enhance the mobile experience and is widely used in smartphones and tablets. The Open Handset Alliance supports open standards and services for Android devices. Learn about Android's history, features, software stack, components, development environment, and how to create your first Android application using Android Studio.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Android App Development By Dr. Dinesh Sharma Associate Professor and Software Developer Manipal University Jaipur Web Link : www.drdineshsharma.com
Outline What is Android? Why Android? Android Features Android Software Stack Android Components Android Development Environment(Android Studio) Create First Android Application Android Studio Directory
Cont.. Build and Run Activity Activity Life Cycle etc. Event Listeners Intents
What is Android ? Google's Android is the world s most popular mobile platform. It is a modified version of Linux. Android is a software package and linux based operating system for mobile devices such as tablet computers and smartphones. It is developed by Google and later the OHA (Open Handset Alliance). Java language is mainly used to write the android code even though other languages can be used. The goal of android project is to create a successful real-world product that improves the mobile experience for end users.
What is Open Handset Alliance (OHA) It's a consortium of 84 companies such as google, samsung, AKM, synaptics, KDDI, Garmin, Teleca, Ebay, Intel etc. It was established on 5th November, 2007, led by Google. It is committed to advance open standards, provide services and deploy handsets using the Android Plateform.
History Android, Inc. was founded in October 2003 by Andy Rubin ,Rich Miner, Nick Sears and Chris White to develop, in Rubin's words "smarter mobile devices that are more aware of its owner's location and preferences".
Android Inc. acquired by Google in August, 2005. At Google, the developed a mobile device platform powered by the Linux kernel. On November 5, 2007, the Open Handset Alliance came with a goal to develop open standards for mobile devices.
That day, Android was unveiled as its first product, a mobile device platform built on the Linux kernel version 2.6. The first commercially available phone to run Android was the HTC Dream in 2008. Since 2008, Android has seen updates which have incrementally improved the operating system, adding new features and fixing bugs in previous releases. numerous
Version History Version Code name Release date API level 1.5 Cupcake April 30, 2009 3 1.6 Donut September 15, 2009 4 2.0 2.1 clair October 26, 2009 7 2.2 Froyo May 20, 2010 8 2.3 Gingerbread December 6, 2010 9 3.x Honeycomb May 10, 2011 12 4.0.x Ice Cream Sandwich December 16, 2011 15 4.1.x Jelly Bean July 9, 2012 16 4.2 Jelly Bean November 13, 2012 17 October 31, 2013 19 20 4.4 Kit-Kat November 12, 2014 21 22 5.0-5.1.1 Lollipop October 5, 2015 23 6.0-6.0.1 Marshmallow August 22, 2016 24 25 7.0-7.1.2 Nougat August 21, 2017 26 27 8.0-8.1 Oreo
Why Android? The ability for anyone to customize the Google Android platform The consumer will benefit from having a wide range of mobile applications to choose from since the monopoly will be broken by Google Android Men will be able to customize a mobile phones using Google Android platform like never before
Cont.. Features like weather details, opening screen, live RSS feeds and even the icons on the opening screen will be able to be customized In addition the entertainment functionalities will be taken a much higher by Google Android being able to offer online real time multiplayer games
Difference Between Android and IOS Android IOS Customizability A lot. Can change almost anything. Limited unless jailbroken Easier than iOS. Using USB port and Android File Transfer desktop app. Photos can be transferred via USB without apps. More difficult. Media files can be transferred using iTunes desktop app. Photos can be transferred out via USB without apps. File transfer Available language(s) 100+ Languages 34 Languages Open source Kernel, UI, and some standard apps The iOS kernel is not open source but is based on the open-source Darwin OS.
Categories of Android applications There are many android applications in the market. The top categories are: Entertainment Tools Communication Productivity Personalization Music and Audio Social Media and Video Travel and Local etc.
Android Software Stack Android architecture or Android software stack is categorized into five parts: linux kernel native libraries (middleware), Android Runtime Application Framework Applications
Linux kernal It is the heart of android operating system and present at the bottom of the android architecture. It contains essential hardware drivers like display, audio,camera,Bluetooth,wifi etc. It privides functionalities such as power management, process management and memory management. It provides a level of abstraction between device hardware and upper layer of android software stack.
Native Libraries SQLite It provides various classes used for database management. The WebKit is a web browser engine. responsible for browser support. OpenGL- It is a java interface to the OpenGL ES 3D rendering graphics API. SSL- - It provides internet security. FreeType for font support. Media for playing and recording audio and video formats.
Android Runtime In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is responsible to run android application. DVM is like JVM but it is optimized for mobile devices. It consumes less memory and provides fast performance.
Dalvik Virtual Machine The DVM runs something called dex files, D-E-X and these are byte codes that are the converting at build time. results of
Application Framework It is the fourth section and third layer present of the top of native libraries and android runtime. It provides various APIs like activity manager ,resource manager, content provider, telephony manager etc. The Application Framework is a set of services that collectively form the environment in which Android applications run and are managed..
Services: Views that can be used to build an application, including lists, grids, text boxes, and buttons. Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data . Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files . Notification Manager that enables all applications to display custom alerts in the status bar. Activity Manager that manages the lifecycle of applications and provides a common navigation back stack.
Application Layer Native Apps Developer Apps Third Party Apps The final layer on top is Applications. It includes the home application, the contacts application, the browser, and your apps. And everything at this layer is, again, using the same app framework provided by the layers below.
Android Core Building Blocks An android component is simply a piece of code that has a well defined life cycle e.g. Activity, Receiver, Service etc. The core building blocks components of android are activities, views, intents, services, content providers, AndroidManifest.xml. or fundamental fragments and
Activity An activity is a class that represents a single screen. It is like a Frame in AWT. Activity implementation: layout: .XML file android:layout_width="match_parent android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf=" parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="pare nt" app:layout_constraintTop_toTopOf="parent" android:gravity="center"> public class DemoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_viewmodel _demo); } }
View A view is the UI element such as button, label, text field etc. Anything that you see is a view. What if there are no views that suite your needs? Well, then you can create your own. We ll show you how. Default and Custom View
Our Custom View We re going to create a simple custom view, a coloured circle with a text label. We use our custom view in an activity where the user can press a button to change our custom view s colour and text label
Define your custom attributes The Android framework s views have their own attributes Each view has a number of attributes that we can set in our layout files. An example of Android s Button view as declared in an XML file:
Cont.. We need to define our custom view s attributes We re creating a new view so we have to define our own view attributes. We define our custom attributes in an XML file,res/values/attrs.xml:
Cont.. Note the following: <resources> - we declare our attributes in an XML file with <resources> as the root element <declare-styleable> - we declare our attributes inside the <declare-styleable> element MyCustomView the name of our custom view <attr> - we declare each attribute using the <attr> element. For each attribute, you need to declare a: name the name of the attribute format the format of the attribute Now we re ready to create our custom MyCustomView class.
Service Service is a background process that can run for a long time. There are two types of services local and remote. Local service is accessed from within the application whereas remote service is accessed remotely from other applications running on the same device.
Content Provider Content Providers are used to share data between the applications.
Fragment Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time.
AndroidManifest.xml It contains informations about activities, content providers, permissions etc. It is like the web.xml file in Java EE.
Android Virtual Device (AVD) It is used to test the android application without the need for mobile or tablet etc. It can be created in different configurations to emulate different types of real devices.
Android Emulator Android Emulator is used to run, debug and test the android application. If you don't have the real device, it can be the best way to run, debug and test the application. It uses an open source processor emulator technology called QEMU. The emulator tool enables you to start the emulator from the command line. You need to write: emulator -avd <AVD NAME>