70 likes | 195 Vues
In this lecture, we explore important concepts for developing mobile applications, focusing on image handling and text box behavior. Key topics include managing focus events, loading images from resources versus the environment, and utilizing camera or photo chooser tasks. We'll delve into the differences between project images and online resources, as well as demonstrate how to handle user input efficiently with text change events. Additionally, we’ll cover error handling in task management, providing foundational skills for building robust mobile apps.
E N D
CSS290: Apps on Mobile Devices Lecture 4: Tasks + Working with Images
Today: Concepts • Reading: Chapter 4 (Skip XNA Discussions)) • Focus of TextBox • Get/Lose Focus • Images as resource in project • Enter image as a stream from URI • Images in projects vs. images in the environment • Camera and PhotoChooser Tasks • For fun: • Working with Phone Vibrate • Working with images and camera on the phone
TextBox Focus Events • TextChangeEvent • Invoked once per character input • In focus: • What should the behavior be? • Start editing: what is your expectation? (selected text?) • Out of focus: • Have the final input
System Resources • Images of a project vs. Photos on the phone • What is the difference? • How to load either? • The Image GUI element • Capable of displaying an image • The BitmapImage utility • Source from project environment (URI) • URI – Uniform Resource Identifier (a name) • Source from online (if you have wifi, or 3G connection) • Relative vs. Absolute URI
Tasks: Threads?! • Activating a “Task” from our App • The Camera Task and PhotoChooserTask • Function calls that may fail! • Try/Catch
Exercise • Add touch volume control to our simple audio playback App • Due beginning of next class
References • More on Tasks (with return value) and Launchers (start an App): • http://msdn.microsoft.com/en-us/library/ff428753%28v=VS.92%29.aspx