Engage! Android User Input, Variables,

Slides:



Advertisements
Similar presentations
Chapter 3: Engage! Android User Input, Variables, and Operations
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Chapter 6 Jam! Implementing Audio in Android Apps.
Chapter 6: Jam! Implementing Audio in Android Apps.
The Web Warrior Guide to Web Design Technologies
Microsoft Excel 2003 Illustrated Complete A Worksheet Formatting.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Guide To UNIX Using Linux Third Edition
Creating Web Page Forms
Android Development (Basics)
Microsoft Visual Basic 2005 ENRICHMENT CHAPTER Visual Studio Tools for Office.
Programming with Microsoft Visual Basic th Edition
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Visual Basic Chapter 1 Mr. Wangler.
CS5103 Software Engineering Lecture 08 Android Development II.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 9: Customize! Navigating with Tabs on a Tablet App.
Chapter 10: Move! Creating Animation
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
Creating a Web Site to Gather Data and Conduct Research.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Chapter 12: Finale! Publishing Your Android App
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
Input, Output, and Processing
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 7: Reveal! Displaying Pictures in a GridView.
CREATING TEMPLATES CREATING CUSTOM CHARACTERS IMPORTING BATCH DATA SAVING DATA & TEMPLATES CREATING SERIES DATA PRINTING THE DATA.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Android Boot Camp for Developers Using Java, 3E
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Tables Sacramento City College Engineering Design Technology.
Applications Development
Introduction to Database using Microsoft Access 2013 Part 6.1 November 18, 2014.
1 Chapter 6: Using Prompts in Tasks and Queries 6.1 Prompting in Projects 6.2 Creating and Using Prompts in Tasks 6.3 Creating and Using Prompts in Queries.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
Chapter 3 Automating Your Work. It is frustrating when you have to type the same passage of text repeatedly. For example your name and address. Word includes.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Chapter 10 Creating a Template for an Online Form Microsoft Word 2013.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 18 Getting Started with Excel Essentials 1 Morrison / Wells / Ruffolo.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Building User Interfaces Basic Applications
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 10: Move! Creating Animation 1 Android.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
This screen may be skipped altogether if the user chooses a report from the server and clicks Ad Hoc or Edit or whatever. Also, the next screen would ordinarily.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 2: Simplify! The Android User Interface
Explore! Icons and Decision-Making Controls
Chapter 4: Explore! Decision-Making Controls
Android Boot Camp for Developers Using Java, 3E
Variables and Arithmetic Operations
MODULE 7 Microsoft Access 2010
Chapter 3 The DATA DIVISION.
Guidelines for Microsoft® Office 2013
User Interface Screen Elements
User Interface Screen Elements
Presentation transcript:

Engage! Android User Input, Variables, Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 3: Engage! Android User Input, Variables, and Operations Android Boot Camp for Developers Using Java, 2nd Ed.

Objectives In this chapter, you learn to: Use an Android theme Add a theme to the Android Manifest file Develop the user interface using Text Fields State the role of different Text Fields Display a hint using the Hint property Develop the user interface using a Spinner control Add text to the String table Android Boot Camp for Developers Using Java, 2nd Ed.

Objectives (continued) Add a prompt to the Spinner control Declare variables to hold data Code the GetText() method Understand arithmetic operations Convert numeric data Format numeric data Code the SetText() method Run the completed app in the emulator Android Boot Camp for Developers Using Java, 2nd Ed.

Android Themes Engaging the user by requesting input customizes the user experience each time the application is executed A theme is a style applied to an Activity or an entire application The default theme is a title bar (often gray) with a black background Android Boot Camp for Developers Using Java, 2nd Ed.

Android Themes (continued) Previewing a Theme Check the main.xml file in the emulator to see what your screen looks like Android Boot Camp for Developers Using Java, 2nd Ed.

Android Themes (continued) Updating the Theme in the Android Manifest File Insert this code into the AndroidManifest.xml file android:theme="@android:style/Theme.Black.NoTitleBar“ Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input The onscreen keyboard is called a soft keyboard Input can be in the form of tapping or gestures (using two fingers to pan, rotate, or zoom) Primary design challenge is to simplify user experiences Use legible fonts, simplify input, and optimize each device’s capabilities to maximize user experience Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Android Text Fields Text Fields are the most common type of mobile input Can be free-form plain text Numbers A person’s name, password, email, phone number A date Multiline text Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Adding a Text Field Use the Id property in the Properties pane to enter a name that begins with the prefix txt Use descriptive names like txtTickets instead of txtText1 Using the String Table Uses the file strings.xml A string is a series of alphanumeric characters that can include spaces. Localization is the use of the String table to change text based on the user’s preferred language. Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Using the String Table (Continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Using the String Table (Continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) String Arrays Multiple text strings can be stored in the strings.xml file A control such as a Spinner can be populated with a string array Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Setting the Hint Property for the Text Field A hint is a short description of a field visible as light-colored text (called a watermark) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Using the Android Spinner Control A Spinner control is similar to a drop-down list for selecting a single item from a fixed list The spinner control displays a list of strings called items in a pop-up window A prompt, which can be used to display instructions at the top of the Spinner control, also is stored in strings.xml and is named prompt The Spinner property called Entries connects the String Array to the Spinner control for display in the application Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Adding the Button, TextView, and ImageView Controls Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Coding the EditText Class for the Text Field A variable is used in programming to contain data that changes during the execution of a program Final variables can be initialized but cannot be changed Insert this code to create a variable: final EditText tickets=(EditText) findViewById(R.id.txtTickets); Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Coding the Spinner Control final Spinner group = (Spinner) findViewById(R.id.txtGroup); Coding the ButtonControl final TextView result = ((TextView)findViewById(R.id.txtResult)); Android Boot Camp for Developers Using Java, 2nd Ed.

Simplifying User Input (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Declaring Variables (continued) Declare the variable Assign a value to the variable Primitive Data Types Android Boot Camp for Developers Using Java, 2nd Ed.

Declaring Variables (continued) String Data Type The String type is a class and not a primitive data type A string can be a character, word, or phrase Declaring the Variables Typically declared at the beginning of an Activity Variables must be declared before you can use them Android Boot Camp for Developers Using Java, 2nd Ed.

Declaring Variables (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Declaring Variables (continued) GetText() Method Read data stored in the EditText control with the GetText() method Data is read in as a string, by default A Parse class is used to convert strings into numbers Android Boot Camp for Developers Using Java, 2nd Ed.

Working with Mathematical Operations Android Boot Camp for Developers Using Java, 2nd Ed.

Working with Mathematical Operations Arithmetic Operators Android Boot Camp for Developers Using Java, 2nd Ed.

Working with Mathematical Operations (cont’d) Formatting Numbers Currency format requires a dollar sign, a comma (if needed), a decimal point, and two decimal places Java has a class called DecimalFormat that provides patterns, such as $###,###.## for displaying on the Android screen Android Boot Camp for Developers Using Java, 2nd Ed.

Displaying Android Output GetSelectedItem() Method The GetSelectedItem() method returns the text label of the currently selected Spinner item SetText () Method The SetText() method displays text in a TextView control result.setText("Total Cost for " + groupChoice + " is " + currency.format(totalCost)); Android Boot Camp for Developers Using Java, 2nd Ed.

Displaying Android Output (continued) Android Boot Camp for Developers Using Java, 2nd Ed.

Summary Assign a theme to an Activity or an entire application to prevent apps from looking too similar Define a theme in the Android Manifest file for each Activity Use Text Fields to request input from users Use a control’s Hint property to provide guidelines to users so they know what to enter Use the EditText class to extract text users have entered and store that text in a variable Use GetText() to get data and SetText() to display data Android Boot Camp for Developers Using Java, 2nd Ed.

Summary (continued) Strings.xml is part of every Android application You can edit a string in the strings.xml file to update text anywhere in the application Use GetSelectedItem() to return the text of the selected Spinner item To use a variable, you must first declare it Variables are declared at the beginning of an Activity Convert variables to the correct data type using the Parse class Android Boot Camp for Developers Using Java, 2nd Ed.