Q.1 Explain the dialog and also explain the Demonstrate working dialog in android.

Similar documents
Android Programs Day 5

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop

Android Coding. Dr. J.P.E. Hodgson. August 23, Dr. J.P.E. Hodgson () Android Coding August 23, / 27

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

1. Simple List. 1.1 Simple List using simple_list_item_1

Create Parent Activity and pass its information to Child Activity using Intents.

@Bind(R.id.input_ ) EditText EditText Button _loginbutton;

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Android Dialogs. Dialogs are simple visual objects that pop up and display a message or prompt for some user input.

Accelerating Information Technology Innovation

Mobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences

Our First Android Application

Meniu. Create a project:

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

South Africa Version Control.

05. RecyclerView and Styles

B9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam;

Programming with Android: Animations, Menu, Toast and Dialogs. Luca Bedogni. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

<uses-permission android:name="android.permission.internet"/>

Tabel mysql. Kode di PHP. Config.php. Service.php

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

Intents. Your first app assignment

Android Apps Development for Mobile Game Lesson 5

UNDERSTANDING ACTIVITIES

Android Application Development. By : Shibaji Debnath

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

Building MyFirstApp Android Application Step by Step. Sang Shin Learn with Passion!

ANDROID PROGRAMS DAY 3

Android Workshop: Model View Controller ( MVC):

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Android/Java Lightning Tutorial JULY 30, 2018

Android Beginners Workshop

Vienos veiklos būsena. Theory

UI, Continued. CS 2046 Mobile Application Development Fall Jeff Davidson CS 2046

Multiple devices. Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

External Services. CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion

07. Menu and Dialog Box. DKU-MUST Mobile ICT Education Center

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

Practical 1.ListView example

COMP4521 EMBEDDED SYSTEMS SOFTWARE

More Effective Layouts

CSCU9YH Development with Android

Database Development In Android Applications

INTRODUCTION TO ANDROID

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World

Have a development environment in 256 or 255 Be familiar with the application lifecycle

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps.


Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.

Creating a User Interface

Produced by. Mobile Application Development. Eamonn de Leastar

Overview. Android Apps (Partner s App) Other Partner s App Platform. Samsung Health. Server SDK. Samsung Health. Samsung Health Server

Android framework overview Activity lifecycle and states

LECTURE NOTES OF APPLICATION ACTIVITIES

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.

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

Mobile Application Development MyRent Settings

LECTURE 08 UI AND EVENT HANDLING

Android Programming (5 Days)

public AnimLayer(Context context, AttributeSet attrs, int defstyle) { super(context, attrs, defstyle); initlayer(); }

Basic GUI elements - exercises

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

ANDROID USER INTERFACE

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Android User Interfaces. Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

CS 4330/5390: Mobile Application Development Exam 1

Android Apps Development for Mobile Game Lesson Create a simple paint brush that allows user to draw something (Page 11 13)

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?

EMBEDDED SYSTEMS PROGRAMMING Application Basics

Android 4: New features for Application Development

Manifest.xml. Activity.java

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu

application components

Tip Calculator. xmlns:tools=" android:layout_width="match_parent"

LifeStreet Media Android Publisher SDK Integration Guide

Lecture 14. Android Application Development

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

else if(rb2.ischecked()) {

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

Software Engineering Large Practical: Storage, Settings and Layouts. Stephen Gilmore School of Informatics October 27, 2017

TextView. A label is called a TextView. TextViews are typically used to display a caption TextViews are not editable, therefore they take no input

Thread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables.

Mobile Computing Practice # 2c Android Applications - Interface

Distributed Systems Assignment 1

M.A.D ASSIGNMENT # 2 REHAN ASGHAR BSSE 15126

Introduction To Android

Android Application Model I

Learn about Android Content Providers and SQLite

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu

Transcription:

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. - A dialog is a small window that prompts the user to make a decision or enter additional information. - A dialog does not fill the screen. - It is normally used for modal events that require users to take an action before they can proceed. - Design the dialog o The Dialog class is the base class for dialogs, but you should avoid instantiating Dialog directly. Instead, use one of the following subclasses: AlertDialog A dialog that can show a title, up to three buttons, a list of selectable items, or a custom layout. DatePickerDialog or TimePickerDialog A dialog with a pre-defined UI that allows the user to select a date or time. DialogFragment A class provides all the controls you need to create your dialog and manage its appearance, instead of calling methods on the Dialog object. - Write a program to Creating dialog package com.example.alertdialog; import com.example.alertdialog.*; import android.os.bundle; import android.app.activity; import android.app.alertdialog; import android.content.dialoginterface; import android.content.intent; import android.view.menu; import android.view.view; public class MainActivity extends Activity protected void oncreate(bundle savedinstancestate) super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); public void open(view view) AlertDialog.Builder alertdialogbuilder = new AlertDialog.Builder(this); Prepared by : Dhaval Patel 1

alertdialogbuilder.setmessage(r.string.decision); alertdialogbuilder.setpositivebutton(r.string.positive_button, new DialogInterface.OnClickListener() public void onclick(dialoginterface arg0, int arg1) Intent positveactivity = new Intent(getApplicationContext(),com.example.alertdialog.Po sitiveactivity.class); startactivity(positveactivity); ); alertdialogbuilder.setnegativebutton(r.string.negative_button, new DialogInterface.OnClickListener() ); public void onclick(dialoginterface dialog, int which) Intent negativeactivity = new Intent(getApplicationContext(),com.example.alertdialog.Ne gativeactivity.class); startactivity(negativeactivity); AlertDialog alertdialog = alertdialogbuilder.create(); alertdialog.show(); public boolean oncreateoptionsmenu(menu menu) // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); Prepared by : Dhaval Patel 2

Q.2 List and explain the different Method type & description in android. Sr.No Method type & description seticon(drawable icon) 1 This method set the icon of the alert dialog box. setcancelable(boolean cancelable) 2 This method sets the property that the dialog can be cancelled or not setmessage(charsequence message) 3 This method sets the message to be displayed in the alert dialog setmultichoiceitems(charsequence[] items, boolean[] checkeditems, DialogInterface.OnMultiChoiceClickListener listener) 4 This method sets list of items to be displayed in the dialog as the content. The selected option will be notified by the listener setoncancellistener(dialoginterface.oncancellistener oncancellistener) 5 This method Sets the callback that will be called if the dialog is canceled. settitle(charsequence title) 6 This method set the title to be appear in the dialog Q.3 What is menu in android? Explain the custom menu and system menu in android. OR Write the different between custom menu and system menu. - Menus are a common user interface component in many types of applications. - It provide a familiar and consistent user experience. - You should use the Menu APIs to present user actions and activities using menu. - All activity used using menu. - System menu o Most of the mobile manufacturers include a hidden service menu in their mobile handsets. o These menus allow users (or developers) to access some technical information and service to access service details etc. o For that purpose there are design system menu - Custom menu o We implemented our own custom menu to match the look and feel of the app. o The good thing about the custom menu is that, it fits right inside the actual menu container provided by Android. o A devices that doesn t have a hardware button, it shows as a popup, and one those that have a hardware menu button, it shows on the side of the menu is called custom menu. Prepared by : Dhaval Patel 3

Q.4 Create and Use Handset menu Button. Or Create menu in android. - Android application menu is one of the important user interface entity which provides some action options for a particular view - Step for creation. 1. Create a new project File New Android Project and give activity name as AndroidMenusActivity. 2. Now create an XML file under res/layout folder and name it as menu.xml. 3. Open menu.xml file and type following code. In the following code we are creating a single menu with 6 menu items. Each menu item has an icon and title for display the label under menu icon. Also we have id for each menu item to identify uniquely.» menu.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Single menu item Set id, icon and Title for each menu item --> <item android:id="@+id/menu_bookmark" android:icon="@drawable/icon_bookmark" android:title="bookmark" /> <item android:id="@+id/menu_save" android:icon="@drawable/icon_save" android:title="save" /> <item android:id="@+id/menu_search" android:icon="@drawable/icon_search" android:title="search" /> <item android:id="@+id/menu_share" android:icon="@drawable/icon_share" android:title="share" /> <item android:id="@+id/menu_delete" android:icon="@drawable/icon_delete" android:title="delete" /> <item android:id="@+id/menu_preferences" android:icon="@drawable/icon_preferences" android:title="preferences" /> </menu> Prepared by : Dhaval Patel 4

4. Now open your main Activity class file (AndroidMenusActivity.java) and type following code. In the following code each menu item is identified by its ID in switch case statement.» AndroidMenusActivity.java package com.androidhive.androidmenus; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.widget.toast; public class AndroidMenusActivity extends Activity public void oncreate(bundle savedinstancestate) super.oncreate(savedinstancestate); setcontentview(r.layout.main); // Initiating Menu XML file (menu.xml) public boolean oncreateoptionsmenu(menu menu) MenuInflater menuinflater = getmenuinflater(); menuinflater.inflate(r.layout.menu, menu); /** * Event Handling for Individual menu item selected * Identify single menu item by it's id * */ public boolean onoptionsitemselected(menuitem item) switch (item.getitemid()) case R.id.menu_bookmark: // Single menu item is selected do something // Ex: launching new activity/screen or show alert message Toast.makeText(AndroidMenusActivity.this, "Bookmark is case R.id.menu_save: Toast.makeText(AndroidMenusActivity.this, "Save is case R.id.menu_search: Toast.makeText(AndroidMenusActivity.this, "Search is Prepared by : Dhaval Patel 5

case R.id.menu_share: Toast.makeText(AndroidMenusActivity.this, "Share is case R.id.menu_delete: Toast.makeText(AndroidMenusActivity.this, "Delete is case R.id.menu_preferences: Toast.makeText(AndroidMenusActivity.this, "Preferences is default: return super.onoptionsitemselected(item); 5. Finally run your project by right clicking on your project folder Run As 1 Android Application to test your application. On Android Emulator click on Menu Button to launch menu. Q.5 Explain and create android pop up menu. - Android Popup Menu displays the menu below the anchor text if space is available otherwise above the anchor text. - It disappears if you click outside the popup menu. Prepared by : Dhaval Patel 6

Activity_main.xml popup_menu.xml Prepared by : Dhaval Patel 7

Activity class Prepared by : Dhaval Patel 8

Q.6 Explain Toast in android. How it create. - Toast is a solution for android developer when required to notify user about an operation without expecting any user input. - This provides a small popup that displays for a small period and display out automatically after timeout. - Sometimes developers use this for debugging. - For example, some of the app shows Press back once to Exit message when pressed back button in home page. Another real-time example is Gmail app, It shows a Toast, when a mail message is saved to draft. How to Create a Toast Checkout below code snippet to show an simple toast in Android //display in short period of time Toast.makeText(getApplicationContext(), "Your toast message.", Toast.LENGTH_SHORT).show(); //display in long period of time Toast.makeText(getApplicationContext(), "Your toast message", Toast.LENGTH_LONG).show(); Q.7 Basic operation of SQLite Database - Creating the database o SQLite database file with two tables: One with and one without a PRIMARY KEY column - Adding new columns o After creating data base we can add new coloum using this operation - Inserting and updating rows o We can add or remove the rows - Creating unique indexes o For searching the data we can create the unique index - Querying the database - Selecting rows o We can use the query statement for done different process like insert, update, delete etc. - Security and injection attacks - Date and time operations o It does not only allow us to insert dates and times in various different formats only standard format which we implement. - Retrieving column names Prepared by : Dhaval Patel 9