CS 4330/5390: Mobile Application Development Exam 1

Similar documents
Android Basics. Android UI Architecture. Android UI 1

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

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

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

Android Application Development

Introduction To JAVA Programming Language

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

CMSC436: Fall 2013 Week 3 Lab

Vienos veiklos būsena. Theory

ANDROID USER INTERFACE

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

UI Fragment.

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

Let s take a display of HTC Desire smartphone as an example. Screen size = 3.7 inches, resolution = 800x480 pixels.

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

Comp 595MC/L: Mobile Computing CSUN Computer Science Department Fall 2013 Midterm

CHAPTER 4. Fragments ActionBar Menus

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu

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

GUI Design for Android Applications

Fragments. Lecture 11

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

Lifecycle Callbacks and Intents

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

Programming with Android: Android for Tablets. Dipartimento di Scienze dell Informazione Università di Bologna

LECTURE 08 UI AND EVENT HANDLING

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

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

Mobile User Interfaces

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

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Android Application Model I

Overview of Activities

Solving an Android Threading Problem

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

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

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

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

Building User Interface for Android Mobile Applications II

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location.

Mobile Application Development Android

INTRODUCTION TO ANDROID

Topics of Discussion

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

Starting Another Activity Preferences

EMBEDDED SYSTEMS PROGRAMMING Application Basics

User Interface Development. CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr.

Minds-on: Android. Session 2

CS260 Intro to Java & Android 05.Android UI(Part I)

Mobile Computing Practice # 2c Android Applications - Interface

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

CS 3360 Design and Implementation of Programming Languages. Exam 1

CE881: Mobile & Social Application Programming

Embedded Systems Programming - PA8001

EMBEDDED SYSTEMS PROGRAMMING UI and Android

LECTURE NOTES OF APPLICATION ACTIVITIES

Android Fundamentals - Part 1

Our First Android Application

Praktikum Entwicklung Mediensysteme. Implementing a User Interface

CS 3360 Design and Implementation of Programming Languages. Exam 1

Computer Science E-76 Building Mobile Applications

Programming Android UI. J. Serrat Software Design December 2017

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

Creating a Custom ListView

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

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

Lab 1 - Setting up the User s Profile UI

Android UI: Overview

Activities and Fragments

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Upon completion of the second part of the lab the students will have:

CS371m - Mobile Computing. More UI Action Bar, Navigation, and Fragments

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

More Effective Layouts

CS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

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

Fragments and the Maps API

Android UI DateBasics

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

Application Fundamentals

CS 3331 Advanced Object-Oriented Programming Exam 1

Mobile Computing Fragments

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

CS260 Intro to Java & Android 05.Android UI(Part I)

ListView Containers. Resources. Creating a ListView

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

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

CPET 565 Mobile Computing Systems CPET/ITC 499 Mobile Computing. Lab & Demo 2 (Part 1-2) Hello-Goodbye App Tutorial

Android Programs Day 5

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

States of Activities. Active Pause Stop Inactive

05. RecyclerView and Styles

ES E 3 3 L a L b 5 Android development

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

Mobila applikationer och trådlösa nät, HI1033, HT2013

Xin Pan. CSCI Fall

Transcription:

1 Spring 2017 (Thursday, March 9) Name: CS 4330/5390: Mobile Application Development Exam 1 This test has 8 questions and pages numbered 1 through 7. Reminders This test is closed-notes and closed-book. However, you are allowed to bring 1 page (8.5 X 11) of notes (both sides). Your notes must be your own, they must be hand written, and they must be turned in with your test. This test is to be done individually, and you are not to exchange or share materials such as the textbook and notes with other students during the test. If you need more space, use the back of a page. Note when you do that on the front. This test is timed. Your test will not be graded if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire test so that you can budget your time. For program code, clarity is important; if your writings or code are sloppy and hard to read, you will lose points. Correct syntax also makes some difference. There are 100 points all. 1. (total 20 points) Short answers: multiple choice and fill-in-the-blank (a) (2 points) All Android apps have an automatically generated file named.java. It provides references (or resource Ids) to various resources used by the applications, e.g., layouts and drawables/mipmaps. That is, instead of hard coding such resources into an application, one externalizes and refers them by Ids. (b) (2 points) All the following layouts are supported by Android EXCEPT for: i. FrameLayout ii. GridLayout iii. GridBagLayout iv. LinearLayout v. RelativeLayout vi. TableLayout (c) (2 points) You use the view to provide visual feedback about some ongoing tasks, such as when you are performing a long-running task in the background. For example, you might be downloading some data from the Web and need to update the user about the status of the download. (d) (2 points) A represents a behavior or a portion of user interface in an activity. It is particularly useful in adapting a user experience across a wide range of devices, as they can be combined to build a multi-pane UI and be reused in multiple activities.

2 (e) (2 points) There are several framework methods to be called on various stages of an activity from its creation to destruction. This is the framework method where you initialize your activity. In this method you usually call the setcontentview() method to set the UI of your activity. i. oncreate() ii. onstart() iii. onrestart() iv. onresume (f) (2 points) In general, you use the startactivity() framework method to invoke an activity. However, it doesn t return a result from the called activity to the calling activity. If you need to pass data back from the called activity, you should instead use the () method to invoke it. (g) (2 points) As stated in the previous question, an activity can indicate its intention to receive a result when invoking another activity. However, to actually receive data from the called activity, you override the () method in the calling activity class. (h) (2 points) Android provides three different types of menus: options (actions/tools), context, and popup. Which type of menus is described below? It displays information related to a particular view of an activity. It is a floating menu owned by or associated with a view. Its menu items can be defined statically in an XML resource file or programmatically in source code. It can be activated by any UI event such as button click. (i) (2 points) To provide the options (actions/tools) menu for your activity, you need to override two framework methods in your activity: oncreateoptionsmenu() and. The first method is called to populate a menu with menu items, and the second method is called when a menu item is selected. (j) (2 points) A fragment has its own lifecycle. Which of the following lifecycle methods is not one of those that are most commonly overridden in a fragment class? i. onattach() ii. oncreate() iii. oncreateview() iv. onpause()

3 2. (4 points) One of the noticeable features of Android programming is the use of XML. List at least four different uses of XML. 3. (5 points) There are several different units of measurement that you can use to specify the size or dimension of an Android UI element. Which unit is recommended for specifying the size of a view? Justify your answer by stating the reason. 4. (6 points) Describe the difference between explicit and implicit intents. Do not use the terms explicit and implicit in your description. 5. (5 points) The term adaptive design refers to the adaptation of a layout design that fits an individual screen size and/or orientation. It is important to Android because it supports flexibility when designing an app that can work on multiple devices. Describe briefly the Android approach for providing several alternative layouts to target different screen configurations (e.g., sizes)..

4 6. (total 25 points) You are to develop a login component of some Android app. You will be writing it incrementally by completing given skeletal code. (a) (10 points) Let s first define its UI the login screen of the app by completing the skeletal activity main.xml file give below. As shown below, the login UI consists of only a few views. You may need to specify their attributes (e.g., android:id) to refer to them in your activity class (see Problem 6b below). For layouts, use only the LinearLayout class; you are not allowed to use any other layout classes. <!-- activity_main.xml --> <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- WRITE YOUR CODE HERE! --> </LinearLayout>

5 (b) (15 points) Next, let s code the logic of the login component handling a login request by checking the user name. When the login button is clicked, the app checks if the provided user name is known to the system. If that s the case, it will show a welcome toast message (see a sample screen below); otherwise, the login request is ignored, i.e., nothing happens. Use the given LoginManager class to check the validity of a user name. Hint: you need to define only one or two methods, including the oncreate() method. public class MainActivity extends Activity { private static class LoginManager { /** Is the given user name known to the system? */ public boolean isknownuser(string name) {... } } private void toast(string msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } <!-- WRITE YOUR CODE HERE! --> }

6 7. (20 points) Here you are to modularize the login app of the previous problem by separating the logic of checking a user name and that of welcoming a user (see below for an improved UI). For this, you will be creating a new activity named WelcomeActivity. This activity is to be invoked by the main activity and to show a welcome toast message. (a) Change the code of MainActivity to invoke the WelcomeActivity class when a user is successfully logged in. You should pass the user name to the WelcomeActivity class. Assume that the following definition is already included in the AndroidManifest.xml file. <activity android:name=".welcomeactivity" android:label="@string/welcome" > <intent-filter> <action android:name="edu.utep.cs.cs4330.exam1.welcome" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> (b) Define the WelcomeActivity class to show a welcome toast message. Don t worry about its UI other than the toast message. Hint: you need to define/override only one method.

7 8. (15 points) Let s reconsider the login app of the previous problem. Let s improve its user experience by providing a different UI depending on the screen orientation. That is, you will be providing a new UI for the landscape mode (see the sample screen below). All the views of the UI form a single row. Both the name label and the login button have natural widths, and the edit widget in the middle has all the remaining space. Describe your approach for providing two different UIs, one for the portrait mode and the other for the landscape. Define the UI for the landscape mode by being specific about its full pathname (directory and file names). As before, use only the LinearLayout class for layouts.