M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2

Similar documents
Android Programming - Jelly Bean

Mobile Application Development Android

Android Programming (5 Days)

MC Android Programming

Pro Android 2. Sayed Y. Hashimi Satya Komatineni Dave Mac Lean. Apress

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Data-Driven Views and Android Components Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

Building User Interface for Android Mobile Applications II

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android?

Android UI DateBasics

Android App Development

1. What are the key components of Android Architecture? 2. What are the advantages of having an emulator within the Android environment?

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

CORE JAVA& ANDROID SYLLABUS

Configuring the Android Manifest File

Learn about Android Content Providers and SQLite

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

Android Programming: More User Interface. CS 3: Computer Programming in Java

what we will cover - setting up multiple activities - intents - lab 2 What you need to know for Lab 2

Android Application Development 101. Jason Chen Google I/O 2008

CS371m - Mobile Computing. Content Providers And Content Resolvers

ORACLE UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 1

ANDROID SYLLABUS. Advanced Android

Understanding Application

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Introduction to Android

AND-401 Android Certification. The exam is excluded, but we cover and support you in full if you want to sit for the international exam.

Android Development Crash Course

Android Application Development

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based.

Android Programming Lecture 2 9/7/2011

UNDERSTANDING ACTIVITIES

06. Advanced Widget. DKU-MUST Mobile ICT Education Center

Practical Problem: Create an Android app that having following layouts.

Computer Science E-76 Building Mobile Applications

Automatically persisted among application sessions

GUI Design for Android Applications

Course Learning Outcomes (CLO): Student Outcomes (SO):

Syllabus- Java + Android. Java Fundamentals

Chapter 5 Defining the Manifest

Android Overview. Most of the material in this section comes from

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

Mobile Computing Practice # 2a Android Applications - Interface

Introduction to Android

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

Android Online Training

Content Provider. Introduction 01/03/2016. Session objectives. Content providers. Android programming course. Introduction. Built-in Content Provider

GUJARAT TECHNOLOGICAL UNIVERSITY

Android Training Overview (For Demo Classes Call Us )

CS378 -Mobile Computing. Intents

Programming Android UI. J. Serrat Software Design December 2017

Programming in Android. Nick Bopp

ITG Software Engineering

Android Application Development Course 28 Contact Hours

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

Beginning Android 4 Application Development

CS371m - Mobile Computing. User Interface Basics

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Mobile Application Development Android

Mobile Programming Lecture 1. Getting Started

Androidfp_printOnly.book Page vii Tuesday, October 4, :15 AM. Contents. Before You Begin

ANDROID COURSE BROCHURE

Mobile Programming Lecture 3. Resources, Selection, Activities, Intents

LECTURE NOTES OF APPLICATION ACTIVITIES

Programming with Android: Activities and Intents. Dipartimento di Informatica Scienza e Ingegneria Università di Bologna

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ]

Required Core Java for Android application development

Mobile Application Development

CS378 -Mobile Computing. User Interface Basics

Android Components. Android Smartphone Programming. Matthias Keil. University of Freiburg

Developer s overview of the Android platform

ES E 3 3 L a L b 5 Android development

Activities and Fragments

ListView Containers. Resources. Creating a ListView

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

Android" Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition

South Africa Version Control.

Android Programming in Bluetooth Cochlea Group

Android Components Android Smartphone Programming. Outline University of Freiburg. Data Storage Database University of Freiburg. Notizen.

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking

Application Fundamentals

COSC 3P97 Mobile Computing

Android App Development

IGEEKS TECHNOLOGIES. Software Training Division. Academic Live Projects For BE,ME,MCA,BCA and PHD Students

Intents & Intent Filters. codeandroid.org

Programming with Android: Intents. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna

Developing Android Applications

SHWETANK KUMAR GUPTA Only For Education Purpose

Lab 3. Accessing GSM Functions on an Android Smartphone

Introduction To Android

Presentation Outline 10/16/2016

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

Mobile Computing. Introduction to Android

In this Class Mark shows you how to put applications into packages and how to run them through the command line.

Transcription:

M.C.A. Semester V Subject: - Mobile Computing (650003) Week : 2 1) What is Intent? How it is useful for transitioning between various activities? How intents can be received & broadcasted. (Unit :-2, Chapter :-4) What is Intent? Definition: Intent (android.content.intent) is an asynchronous message mechanism used by the Android operating system to match task requests with the appropriate Activity or Service (launching it, if necessary) and to dispatch broadcast Intents events to the system at large. Package: android.content.intent. How it is useful for transitioning between various activities? Android app have multiple entry points, No main function. One activity is designated as main / launcher activity in manifest file To transition from one activity to other after creating instance call startactivity() method which has Intent instance as argument. Activity can be launched in many ways using Intent o Launching new activity by class name (Creating simple intent) Create instance of Intent with argument as target activity as startactivity(new Intent(getApplicationContext()MyDrawActivity.class)); o Creating Intent with Action & Data Intent object are composed of two main parts: the action to be performed, and the data to be acted upon. Most common action types : ACTION_MAIN, ACTION_EDIT Here, intent is saying Do this (action) to that (data). o Launching activity belonging to other application using Intent. Appropriate permission required to access activity of other package. Create instance of Intent with two information : action & data E.g. Intent dial = new Intent(Intent.ACTION_DIAL, number); o Passing additional data using Inent Use Extras property 1

It stores info. In Bundle object Create instance of Intent, use putextra() method to put some data in form name/value pair as two arguments to it. Receiving & Broadcasting Intent o Broadcast Intent boradcastintent() method is used. Purpose: To inform other applications about something interesting, use special intent action types. Special intent action e.g. ACTION_BATTERY_LOW, ACTION_BATTERY_CHANGED. (sdcard state changed, application install/uninstall) o Receiving Broadcasted Intent Receive the broadcast using BroadcastReceiver 2) Explain various application settings using android manifest file. (Unit :-2, Chapter :- 5) Settings to be done in AndroidManifest.xml Application s identity o Versioning (<manifest> tag, android:versioncode & android:versionname attributes). o Application name & icon (<application tag, android:icon & android:label attributes) System requirements o Target SDK Version (<manifest> parent tag, <uses-sdk> child tag, android:minsdkversion, android:maxsdkversion, android:targetsdkversion attributes, values integer no. specifying api level) Application platform requirement o Supported Input Methods (<manifest> parent tag, <usesconfiguration> child tag, android:reqtouchscreen, android:reqkeyboardtype, android:reqhardkeyboard, android:reqnavigation, android:reqfivewaynav attributes, values true/false) 2

o Required device features (<manifest> parent tag, <uses-feature> child tag, android:name attributes, values appropriate values as per application requirement) o Supported screen size (<manifest> parent tag, <supports-screen> child tag, android:smallscreens, android:normalscreens, android:largescreens, android:resizable, android:anydensity, values true/false) o Specifying external library reference (<manifest> parent tag, <useslibrary child tag, android:name attribute, values library name that application uses) Registering application s activity, service, broadcast receiver & Intnet-filters o Activity (<manifest> parent tag, <activity> child tag, android:name attributes, values name of the activity class). o Service (<manifest> parent tag, <service> child tag) o Broadcast Receiver (<manifest> parent tag, <receiver> child tag) o Intent-filters (<manifest> parent tag, <intent-filter> child tag, specify <action>, <category> & <data> as sub tags of <intent-filter>) Granting & taking permissions o Grant permission (<permission> tag) o Taking/ receiving permission (<uses-permission tag, android:name attribute) 3) What are dialogs in android? Explain different types of dialogs supported by android. Write in brief lifecycle of a dialog. (Unit :- 3, Chapter :-7) (Ref. pg. no. 165) Dialogs Used to organize information and react to user-driven events. Types of Dialogs o Dialog types (Dialog, AlertDialog, CharacterPickerDialog, DatePickerDialog, ProgressDialog, TimePickerDialog purpose of each & example) o Lifecycle of Dialog (showdialog(), dismissdialog(), removedialog() methods) o Provide unique id to dialog, implement oncreatedialog() method, Implement onpreparedialog(), Launch dialog using showdialog() method) o Example of any of the dialog. 3

4) What are layouts? List built-in layouts supported by android. Explain any two with example. (Unit :- 3, Chapter :- 8) Layouts used to organize screen elements. Layouts can be defined programmatically using java code & as resource using xml way. Built-in Layouts o FrameLayout (Purpose to display stack of child view items, list attributes, example, <FrameLayout> parent tag) o LinearLayout (Purpose to organized child view items, in single row or single column depending on the orientation (horizontal / vertical, list attributes, example, <LinearLayout> parent tag) o RelativeLayout (Purpose to organized child views in relation to each other, list attributes, example, <RelativeLayout> parent tag) o TableLayout (Purpose to organize child view into rows, list attributes, example, <TableLayout> parent tag) o MultipleLayout (Layouts can be nested) 5) Write an android application to create database namely Student, create table student_info. Write android code to demonstrate insert, update, delete & query data to and from this table. (Unit :- 4, Chapter :- 10) Create Database (Ref. pg. no. 240) o Create instance of SQLiteDatabase using openorcreatedatabase() method with three arguments where 1 st arg. Is name of the database ( student_info ), 2 nd arg is mode, 3 rd arg is factory SQLiteDatabase S = openorcreatedatabase("student", SQLiteDatabase.CREATE_IF_NECESSARY, null) Creating table o Write SQL statement to create table, specify table name, column name with data type & constraints: PRIMARY KEY, AUTOINCREMENT, NOT NULL etc. (Note: Foreign key constraint doesn t work with SQLite Database), store it in String variable. o Use execsql method to execute above query stored in string variable. 4

Insert Record o Create instance of Content Values o Use put() method with 2 arguments where 1 st arg name of the column, 2 nd arg. Value to that column) o Use insert() method of SQLiteDatabase instance with 3 arguments, where 1 st arg. Name of the table, 2 nd arg. To provide nullable column names or set to null, 3 rd arg. Content values object) which return long rowid which is unique for every record. Update Record o Create instance of Content values o Use put() method with 2 arguments where 1st arg name of the column, 2nd arg. Value to that column) o Use update() method of SQLiteDatabase instance with 4 arguments, where 1 st arg. Is name of the table, 2 nd arg. Is content value instance, 3 rd arg. Where clause, 4 th substitute value for where clause? parameter) Deleting Record o Use delete() method of SQLiteDatabase instance with 3 arguments, where 1 st arg. Is name of the table, 2 nd arg. Where clause, 3rd substitute value for where clause? parameter) Querying Data o Create a reference variable of Cursor o Use query() method of SQLiteDatabse instance o 8 arguments o 1 st arg Name of the table. o 2 nd arg List of column names o 3 rd arg where clause o 4 th arg where clause substitution for? parameter o 5 th arg GROUP BY clause o 6 th arg HAVING clause o 7 th arg ORDER BY clause o 8 th arg LIMIT clause 5 (2 nd & 4 th arg. Are of string array types, rest arguments are of string type)

6) List default content provider supported by android. Explain CallLog & Broswer content provider with example. (Unit :- 4, Chapter :- 11) Built in Content providers MediaStore Audio visual data on phone and external storage CallLog To access & view sent & receive call. Browser Browser history & bookmarks ContactsContract Phone contact database of phone book Settings System wide device settings and preferences UserDictionary A dictionary of user-defined words for use with predictive text input Call Log Content Provider Purpose To access & view sent & receive call. URI CallLog.Calls.CONTENT_URI. Columns (E.g. to view the name : CallLog.Calls.CACHED_NUMBER_LABEL, Duration : CallLog.Calls.DURATION etc.) Use managedquery() method to retrieve info. for various columns with 5 arguments, with 1 st arg. URI, 2 nd arg. Required columns, 3 rd arg. Where clause to retrieve specific calls only, 4 th arg. Values for where clause? parameter., 5 th arg. Defines sorting order. Use cursor methods to do various operations on that data. Requires permission: <uses-permission> parent tag, android:name attribute, value : android.permission.read_contacts. Browser Content Provider Purpose For user s browser history and bookmarked websites. URI Browser.BOOKMARKS_URI Columns (E.g. to view the name of the website url : Browser.Bookmarkcolumns.TITLE, no. of visits to site : Browser.Bookmarkcolumns.VISITS, whether it is bookmarked : Browser.Bookmarkcolumns.BOOKMARK etc.) Use managedquery() method to retrieve info. for various columns with 5 arguments, with 1 st arg. URI, 2 nd arg. Required columns, 3 rd arg. Where clause 6

to retrieve specific calls only, 4 th arg. Values for where clause? parameter., 5 th arg. Defines sorting order. Use cursor methods to do various operations on that data. Requires permission: <uses-permission> parent tag, android:name attribute, value : android.permission.read_history_bookmarks. 7) Write android application to retrieve network status, call state & service state. To retrieve network status Create instance of ConnectivityManager using getsystemservice() method, pass Context.CONNECTIVITY_SERVICE. ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); Use getnetworkinfo() method of ConnectivityManager instance and receive information in NetworkInfo ref. variable. For wifi network: NetworkInfo ni = cm.getnetworkinfo(connectivitymanager.type_wifi); For Cellular network : NetworkInfo ni = cm.getnetworkinfo(connectivitymanager.type_mobile); Use various methods of NetworkInfo class such as, o isavailable(), isconnected() etc. Take permission to get network information <uses-permission> tag, android:name attribute, android.permission.access_network_state value) To retrieve call state Create instance of TelephonyManager using getsystemservice() method, pass Context.TELEPHONY_SERVICE. TelephonyManager telmanager = (TelephonyManager) getsystemservice(context.telephony_service); Use getcallstate() method of TelephonyManger class to retrieve call state, Call can be at various state such as o TelephonyManger.CALL_STATE_IDLE o TelephonyManger.CALL_STATE_OFFHOOK o TelephonyManger.CALL_STATE_RINGING 7

To continuously listen to the state use listen() method of TelephonyManager class, implement PhoneStateListener() & oncallstatechanged() method. To retrieve service state Create instance of ServiceState. Use getstate() method of ServiceState instance it can be in o o o o ServiceState.STATE_EMERGENCY_ONLY ServiceState.STATE_IN_SERVICE ServiceState.STATE_OUT_OF_SERVICE ServiceState.STATE_POWER_OFF 8) Write an android application that sends text message provided by user to given no. (Unit :-4, Chapter :- 16) Sending SMS : Create SmsManager instance using getdefault() method. Use sendtextmessage() method SmsManager with five arguments where 1 st arg. Is the phone no., 3 rd arg. Is the text message to send. Take permission using <uses-permission> tag, android:name attribute, value android.permission.send_sms. 9) What information are required while packaging android application using Eclipse. Explain steps of packaging android application using eclipse. (Unit :- 5, Chapter :- 29) Setting application name & icon. Versioning the application Verifying the target platform Configuring the android manifest Disable debugging Creating new key, file location, password for managing the keystroke, Preliminary details. 8 10) Write an android application to design tabs for Gallery, List & Grid. Provide demonstration for all these widget in individual tab.

Creating Tabs: Prepare layout file with <TabHost> as parent tag & <TabWidget> as sub tag. Main activity class should extend TabActivity. Create instance of TabHost using gettabhost() method. Use newtabspec() method to add new tab. Use setcontent() method to set the content to that tab, pass intent as arguments. Use addtab() method of TabHost. Create activity for Gallery specify following code : gallery = (Gallery) findviewbyid(r.id.gallery); // String array holding the values String[] text = new String[] { "Hello", "Hi", "Alloha", "Bonjour", "Hallo", " Hola" }; // Array adapter to display our values in the gallery control ArrayAdapter<String> arr = new ArrayAdapter<String>(this, android.r.layout.simple_gallery_item, text); gallery.setadapter(arr); Create activity for List specify the following code : final String[] items = new String[] { "Item1", "Item2", "Item3", "Item4" }; ArrayAdapter ad = new ArrayAdapter( getapplicationcontext(), android.r.layout.simple_list_item_1, items); list = (ListView) findviewbyid(r.id.list); list.setadapter(ad); Create activity for Grid specify the following code : GridView gridview = (GridView) findviewbyid(r.id.gridview); final String[] items = new String[] { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8" }; ArrayAdapter<String> ad = new ArrayAdapter<String>( getapplicationcontext(), android.r.layout.simple_list_item_1, gridview.setbackgroundcolor(color.gray); gridview.setnumcolumns(2); gridview.setgravity(gravity.center); gridview.setadapter(ad); 9