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

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

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

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

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

ANDROID PROGRAMS DAY 3

Android Programs Day 5

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

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

Android Application Development. By : Shibaji Debnath

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

M.A.D Assignment # 1


Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

South Africa

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

MOBILE COMPUTING 1/20/18. How many of you. CSE 40814/60814 Spring have implemented a command-line user interface?

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

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

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

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

Produced by. Mobile Application Development. Eamonn de Leastar

Our First Android Application

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

Basic GUI elements - exercises

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

TPCT s College of Engineering, Osmanabad. Laboratory Manual SDL-II. Mobile Application Development (Android) For. Third Year Students (CSE)

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

1. Simple List. 1.1 Simple List using simple_list_item_1

LECTURE 08 UI AND EVENT HANDLING

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

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

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

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

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State


Intents. Your first app assignment

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

Fragments. Lecture 11

Programming with Android: Layouts, Widgets and Events. Dipartimento di Scienze dell Informazione Università di Bologna

Mobile Software Development for Android - I397

Android UI Development

android:layout_margintop="5dp" > <EditText android:layout_width="210dp"

ANDROID DEVELOPER FUNDAMENTALS (As per the New Syllabus of Mumbai University for S.Y.B.Sc. (Computer Science), Semester IV, )

Programming with Android: Widgets and Events. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

Manifest.xml. Activity.java

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

Android Apps Development for Mobile Game Lesson 5

Vienos veiklos būsena. Theory

StoppUhr. <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="start1"

Dynamically Create Admob Banner and Interstitial Ads

EMBEDDED SYSTEMS PROGRAMMING Android Services

使用 TensorFlow 設計矩陣乘法計算並轉移執行在 Android 上 建國科技大學資管系 饒瑞佶 2017/8

Data Persistence. Chapter 10

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

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

Fragment Example Create the following files and test the application on emulator or device.

Text Properties Data Validation Styles/Themes Material Design

Time Picker trong Android

Accelerating Information Technology Innovation

Press project on the left toolbar if it doesn t show an overview of the app yet.

Android - JSON Parser Tutorial

Lecture 14. Android Application Development

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

Chapter 5 Flashing Neon FrameLayout

Simple Currency Converter

GUI Widget. Lecture6

Database Development In Android Applications

Android/Java Lightning Tutorial JULY 30, 2018

PROGRAMMING APPLICATIONS DECLARATIVE GUIS

Arrays of Buttons. Inside Android

Embedded Systems Programming - PA8001

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

Android Beginners Workshop

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

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

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;

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

Android Hide Title Bar Example. Android Screen Orientation Example

Android Layout Types

else if(rb2.ischecked()) {

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling

ELET4133: Embedded Systems. Topic 15 Sensors

Android - Widgets Tutorial

05. RecyclerView and Styles

1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS.

ANDROID USER INTERFACE

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

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

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

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

Android Workshop: Model View Controller ( MVC):

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

Beginning Android 4 Application Development

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

APPENDIX CODE TO STORE THE BUTTON MENU AND MOVE THE PAGE

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

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

Starting Another Activity Preferences

Transcription:

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

Android Widgets There are given a lot of android widgets with simplified examples such as Button, EditText, AutoCompleteTextView, ToggleButton, DatePicker, TimePicker, ProgressBar etc. Android widgets are easy to learn. The widely used android widgets with examples are given below: Android Button Buttons allows us to control or trigger different events and intents. Example of a button along the code is given at the end of widgets list. Android Toast Displays information for the short duration of time. Custom Toast We are able to customize the toast, such as we can display image on the toast ToggleButton CheckBox AlertDialog Spinner It has only two states. Either it could be ON or OFF. Checkbox allows us to select the multiple options from any given list. AlertDialog displays a alert dialog containing the message with OK and Cancel buttons. Spinner displays the multiple options, but only one can be selected at a time. AutoCompleteTextView It allows us to auto complete our text views so that it could be time saving and efficient.

RatingBar DatePicker TimePicker ProgressBar RatingBar displays the rating of an item or a number up to which it has been rated yet. Datepicker displays the datepicker dialog that can be used to pick the date. TimePicker displays the timepicker dialog that can be used to pick the time. ProgressBar displays progress of any ongoing task or event in application. Android Button Android Button represents a push-button. The android.widget.button is subclass of TextView class and CompoundButton is the subclass of Button class. There are different types of buttons in android such as RadioButton, ToggleButton, CompoundButton etc. Here, we are going to create two textfields and one button for sum of two numbers. If user clicks button, sum of two input values is displayed on the Toast. Drag the component or write the code for UI in activity_main.xml First of all, drag 2 textfields from the Text Fields palette and one button from the Form Widgets palette as shown in the following figure.

The generated code for the UI components will be like this: File: activity_main.xml <RelativeLayout xmlns:androclass="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <EditText android:id="@+id/edittext1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:layout_centerhorizontal="true"

android:layout_margintop="24dp" android:ems="10" /> <EditText android:id="@+id/edittext2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignleft="@+id/edittext1" android:layout_below="@+id/edittext1" android:layout_margintop="34dp" android:ems="10" > <requestfocus /> </EditText> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:text="@string/button" /> </RelativeLayout> File: MainActivity.java package com.example.sumof2numbers; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast;

public class MainActivity extends Activity { private EditText edittext1,edittext2; private Button buttonsum; @Override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); addlisteneronbutton(); public void addlisteneronbutton(){ edittext1=(edittext)findviewbyid(r.id.edittext1); edittext2=(edittext)findviewbyid(r.id.edittext2); buttonsum=(button)findviewbyid(r.id.button1); buttonsum.setonclicklistener(new OnClickListener(){ @Override public void onclick(view view) { String value1=edittext1.gettext().tostring(); String value2=edittext2.gettext().tostring(); int a=integer.parseint(value1); int b=integer.parseint(value2); int sum=a+b; Toast.makeText(getApplicationContext(),String.valueOf(sum),Toast.LENGTH_LONG).show (); ); @Override public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.activity_main, menu);

return true;