Field Trip #30 A Memory Game By Keith Lynn. View A View is the basic building block of an app Some Views hold other views An example of this is GridLayout.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Advertisements

JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
App Customization. Introduction  Not all Android apps look the same  i.e. the default bland black and white look  Most have custom looks like  Background.
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Chapter 6: Jam! Implementing Audio in Android Apps.
 First you have to think up a what kind of game are you going to have it can be any thing from a brick breaker to an role playing game.
Event Handling Events and Listeners Timers and Animation.
Building Memory… Day 7 – April 18, Mouse Listener Attached listeners to each card (but the back image only) When click event is generated, simply.
Reverse Engineering In Rational Rose. Steps to take… Set up new Java project Click on class path.
Creating Mobile Apps with App Inventor! Day 5 Google search Kris Gordon Ludlow for links.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
CS5103 Software Engineering Lecture 08 Android Development II.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2: Simplify! The Android User Interface
Flag Quiz App 1 CS7030: Mobile App Development. assets Folder 2 CS7030: Mobile App Development  drawable folder – Image contents at the root level 
Basic Android Tutorial USF’s Association for Computing Machinery.
Field Trip #26 Create a Find a Word Puzzle in Java By Keith Lynn.
Doodlz App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Using Intents to Broadcast Events Intents Can be used to broadcast messages anonymously Between components via the sendBroadcast method As a result Broadcast.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
We will be creating a spaceship that simulates real movements in space. The spaceship will fire a laser beam that can destroy targets. The spaceship will.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
Android Boot Camp for Developers Using Java, 3E
UI Resources Layout Resources String Resources Image Resources.
Working with GridView Control: Adding Columns. Adding Buttons to a Bound GridView: 1. Drag the WebProduct table from Data connection to a page 2. Demo.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Field Trip #19 Animations with Java By Keith Lynn.
Field Trip #31 CrossWord Puzzle By Keith Lynn. JApplet A JApplet is a top-level container in Java We will use the JApplet to contain two Jpanels The first.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Field Trip #32 Digital Alarm Clock By Keith Lynn.
PHP Form Introduction Getting User Information Text Input.
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
Using an HTML image (img) element’s onclick event to change the source (src) of an iframe to an embedded youtube video.
STAGE 16: FLAPPY. OBJECTIVES  Match blocks with the appropriate event handler  Create a game using event handlers  Share a creative artifact with other.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Field Trip #22 Creating an Excel Spreadsheet with Java By Keith Lynn.
Field Trip #25 Creating a Client/Server By Keith Lynn.
Web Design Part I. Click Menu Site to create a new site root.
Field Trip #23 Hangman By Keith Lynn. JApplet A JApplet is a top-level container An applet is a small Java program that is executed by another program.
Video Games list lab 6  At the end of this lab you will be expected to know:  What Views, View Groups, Layouts, and Widgets are and how they relate to.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Field Trip #27 Using Java to Download Images and Sounds By Keith Lynn.
Right click on the tomato and choose “animation” Go on scribble Right click 2 3.
Programming Games Reprise: radio buttons. Creating instances at runtime. Buttons. Present your sound or video. Final project assignment. Homework: [Catch.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
User Interface Layout Interaction. EventsEvent Handlers/Listeners Interacting with a user.
© 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.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
CSD 340 (Blum)1 Introducing Text Input elements and Ifs.
Events. Slide 2©SoftMoore Consulting Events Events are generated when a user interacts with the view objects of an application. Examples –button clicked–
Flag Quiz Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Notes for Assignment #2 Assn2: GUI Database Interface Corresponds with Chapters 28, 29, 31.
Objective of the lesson Use Blockly to make a dice for Snakes and Ladders All of you will: – Make an image which displays when you press a button Most.
Boxes. SOUNDBOARD Objective: Tap the boxes to play sounds! Demo:
Chapter 2: Simplify! The Android User Interface
Android – Event Handling
Creating Simple Music By Keith Lynn
“Alice  Java” workshop
Creation of an Android App By Keith Lynn
AppLab Studio.code.org.
CS5103 Software Engineering
Android SDK & App Development
Android Project Structure, App Resources and Event Handling
Mobile Computing Dr. Mohsin Ali Memon.
UI Elements 2.
Presentation transcript:

Field Trip #30 A Memory Game By Keith Lynn

View A View is the basic building block of an app Some Views hold other views An example of this is GridLayout A GridLayout puts components in rows and columns

ImageView A View which hold images is ImageView In order to add an image to an app, we drag it to a drawable folder This generates an id in R.java We can create a Drawable using the id with the method getResources().getDrawable(id) We can put the Drawable in the ImageView with the method setImageDrawable

Image When we draw the image into a drawable folder, it generates an id in R.java It creates a nested class called drawable We access the id with R.drawable.id The id is the name of the file

Sound We can add sounds to an app by creating a raw folder under res When we drag a sound file into the raw folder, it generates an id in a nested class in R We can play the sound by creating a MediaPlayer We can play the sound with the method start

Events We can detect and act on events In this app, we use an OnClickListener OnClickListener is an inner class of View It contains the method onClick(View) If the onClickListener is registered on a button, then when we click the button, onClick is called

Handlers A Handler allows you to send and process messages and Runnable objects associated with a Thread We use a handler to delay an activity for a time To create a Handler, we create a Runnable object

The Game In order to play the game, we create two arrays The first array contains 16 ids of images, and the second array contains 16 ids of corresponding sounds For each button, we use its tag A tag is a String associated with a View In the tag we put the id of the image or sound followed by a semicolon followed by the index in the array

The game, cont'd When a button is clicked, a variable called firstButton points to it. The corresponding sound plays When a second button is clicked, we compare the first part of their tags If they are the same, then the images match If they match, then the buttons disappear The game is over when all buttons disappear