Mobile Computing With Android ACST 4550 Android Logs and Gestures

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Using the iPad 9/2/2014. Learning Target I can learn to navigate and use my iPad. Success Criterion: – I can complete at least half of the items on the.
ANDROID – GESTURES L. Grewe. What and why  a great way to interact with applications on mobile devices.  With a touch screen, users can easily tap,
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
Cosc 5/4730 Input Keyboard, touch, and Accelerometer.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
Java: Chapter 1 Computer Systems Computer Programming II Aug
PROG Mobile Java Application Development PROG Mobile Java Application Development Event Handling Creating Menus.
Cosc 5/4730 Input Keyboard, touch, and Accelerometer.
Java: Chapter 1 Computer Systems Computer Programming II.
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.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
Activities and Intents. Activities Activity is a window that contains the user interface of your application,typically an application has one or more.
Using the iPad as of 9/1/15. Learning Target: To learn how to navigate and use my iPad. Success Criterion: I can complete at least half of the items on.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 7: Reveal! Displaying Pictures in a GridView.
Lab 6: event & input intro User Interface Lab: GUI Lab Oct. 2 nd, 2013.
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.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
Applications Development
Mobile Programming Lecture 12 HierarchyViewer, Linkify, Gestures, and Version Control.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android.
Controlling Program Flow with Decision Structures.
Lecture10 Exception Handling Jaeki Song. Introduction Categories of errors –Compilation error The rules of language have not been followed –Runtime error.
Jaeki Song ISQS6337 JAVA Lecture 10 Applets. Jaeki Song ISQS6337 JAVA Applet Applets run within the Web browser environment –Applets bring dynamic interaction.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
JQuery Events, Mobile Events, and Page Events CIS 136 Building Mobile Apps 1.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
CHAPTER 7 TouchGestures. Chapter objectives: To code the detection of and response to touch gestures. Patterns of common touches to create touch gestures.
User Interaction Radan Ganchev Astea Solutions. Content Basic input events Gestures Drag and drop Sensors.
REEM ALMOTIRI Information Technology Department Majmaah University.
CS371m - Mobile Computing Gestures. Common Gestures 2.
TUTORIAL ON MULTITOUCH AND SWIPE GESTURES
Android – Event Handling
Introduction to Event-Driven Programming
FOP: Buttons and Events
Anatomy of an Android App and the App Lifecycle
Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
JavaScript Functions.
The Android Activity Lifecycle
Lesson 1: Buttons and Events – 12/18
Mobile Computing With Android ACST 4550 Bitmaps, Fonts and Gestures
Android 16: Input Events Kirk Scott.
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Cannon Game App Android How to Program
Android Topics UI Thread and Limited processing resources
CS371m - Mobile Computing Gestures.
Android Developer Fundamentals V2
Chapter 7: Touches and Swipes
Android Topics Asynchronous Callsbacks
Testing, debugging, and using support libraries
1/17/2019.
Tonga Institute of Higher Education
Chapter 5 Processing Input with Applets
Interactive Graphics in Android
Mobile Programming Gestures in Android.
Mobile Programming Dr. Mohsin Ali Memon.
Creating a Simple Game in Scratch
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
CIS 470 Mobile App Development
Presentation transcript:

Mobile Computing With Android ACST 4550 Android Logs and Gestures

Logs When your Android App is running on a connected device or an emulator you can capture real-time log messages in the LogCat (for Log Catalog) window. The messages are itemized in the LogCat window by Log Level, TimeStamp, Process ID, Task ID, Application Name (if not generated by the OS), Tag String and Text Message String. The messages are color-coded in the LogCat window like so:

Logs There are 5 standard Levels of Logs being generated continuously by the runtime environment, each with their own color. And for your own debugging purposes you can generate your own Logs with your own Tag strings and Message strings with the following commands: Debug – Blue – Command: Log.d(TagString, MessageString); Error Logs – Red – Command: Log.e(TagString, MessageString); Info Logs – Green – Command: Log.i(TagString, MessageString); Verbose Logs – Black – Command: Log.v(TagString, MessageString); Warning Logs – Orange – Command: Log.w(TagString, MessageString);

The Android Gesture Listener The Android is an operating system for a touch screen device, and as such, it allows for a range of various types of touch events. The following is description of four of the types of touch events that are available (there are others as well): Touch or Tap: The user taps the screen once Double Tap: The user taps the screen twice Long press: The user touches the screen and holds their finger in position Fling: The user touches the screen and quickly flicks their finger across the screen in the direction they’d like to move. Because these events are connected to the screen, the listener for these events (the “Gesture Listener”) is part of the View class and not the Activity class, where normal Controller code should be.

The SimpleOnGestureListener The easiest “Gesture Listener” or “Gesture Detector” to use is called the SimpleOnGestureListener. It can be invoked inside of the onTouchEvent() handler inside of a view. To respond to a gesture you use one of the following methods: public boolean onDown(MotionEvent e) Notified when a tap occurs with the down MotionEvent that triggered it. public void onLongPress(MotionEvent e) Notified when a long press occurs with the initial on down MotionEvent that trigged it. public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) Notified of a fling event with the on down MotionEvent and matching up MotionEvent. public boolean onSingleTapUp(MotionEvent e) Notified when a tap occurs with the up MotionEvent that triggered it. public boolean onSingleTapConfirmed(MotionEvent e) Notified when a single-tap occurs. public boolean onDoubleTap(MotionEvent e) Notified when a double-tap occurs.

The SimpleOnGestureListener The SimpleOnGestureListener class has no method bodies for the Gesture Listener methods (like an Adapter class) so you inherit from it and then override the method handlers you want to use: private class GestureListener extends SimpleOnGestureListener { @Override public boolean onDown(MotionEvent e) { // your handler code goes here return true; } public void onLongPress(MotionEvent e) { The above example just uses the onDown() and onLongPress() methods, but you could use any of the others as well.

The SimpleOnGestureListener You don’t need to use all the SimpleOnGestureListener methods but if you want to use any of them, then you must include the onDown() method and it must return true, because the other methods aren’t activated until that method returns true. In the previous example, you’d first declare a GestureDectector: private GestureDetector gestureDetector; Then instantiate it in your constructor with your Listener like so: gestureDetector = new GestureDetector(context, new GestureListener()); Then you call your handlers from the onTouchEvent() like so: public boolean onTouchEvent(MotionEvent event) { return gestureDetector.onTouchEvent(event); }

The SimpleOnGestureListener You might decide to only use the onDown() method handler if you just care about a single touch on the screen. But if you are interested in Double Taps and Single Taps, then you will need to use the onSingleTapConfirmed() method to verify that a Single Tap is not just the first part of a Double Tap. All of the method handlers are passed a MotionEvent object, which includes numerous details about the touch event that triggered that method being called, such as the location of the touch, the time the event started, how long it took, and even how much pressure was applied, among other things.

The SimpleOnGestureListener In this first example, the onDown() method is used to simply start and stop the waving animation of the Snowman, and in this case we don’t care about Double Taps. Example #1: SnowmanOneGestureView.java The second example handles four gestures, including Single Tap and Double Tap, so onDown() is not directly used, but it still must return true. The four gestures being supported are: Single Tap: Start or Stop the waving Double Tap: Does nothing Long press: Randomly change the color of the Snowman Fling: Make the Snowman white again. Example #2: SnowmanFourGesturesView.java