GATAV 5. Animations Using a Game Loop
|
|
- Veronica Woods
- 6 years ago
- Views:
Transcription
1 GATAV 5. Animations Using a Game Loop
2 TOC 1. The basic principle. 2. Creating bubbles. 3. Making the bubbles more look alive. 4. The appearent look. 5. Making the audiance impressed. 6. Now it up to you: Your exercise. Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 2
3 Animation Basics Any kind of animation is a series of images Animation techniques differ in the kind of image generation Frame Based Animations Every image is a bitmap, which was drawn by somebody in advance Simple concept, but seems not very flexible Tween Based Animations Bitmap images are partitioned; partitions will be animated seperately Animations were described as in between states: start situation, end situation, time duration More complex concept allowing scene flexibility and synchronization Display List Animations Objects (bitmap or vector) are drawn in realtime on calculated paths and under calculated shape and visibility transformations Calculations may depend on user interaction Most flexible, but most complex Almost used in every computer game Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 3
4 The Basic Principle 1. Hijack the view surface 2. Do your own thing Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 4
5 A New Element: User Defined Views BubblesActivity.java package de.fhkl.gatav.ut.bubbles_minus1; import de.fhkl.gatav.ut.bubbles_minus1.r; import android.app.activity; import android.os.bundle; public class BubblesActivity extends Activity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); User defined View a class to be defined //Initializing the view, will instantiate on // object of the class BubblesView setcontentview(r.layout.main); Layout: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <de.fhkl.gatav.ut.bubbles_minus1.bubblesview android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 5
6 The BubblesView - Init s & Helpers package de.fhkl.gatav.ut.bubbles_minus1; import java.util.linkedlist; import android.content.context; import android.util.attributeset; import android.util.log; import android.view.surfaceholder.callback; import android.view.surfaceview; import android.view.surfaceholder; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.rectf; //BubblesView: Manages display handling of app. //Implements SurfaceHolder.Callback to access surface public class BubblesView extends SurfaceView implements SurfaceHolder.Callback { //Surface to hijack private SurfaceHolder surfaceholder = null; //Display refresh thread private GameLoop gameloop; //Certain paint properties and objects private Paint backgroundpaint = new Paint(); private Paint bubblepaint = new Paint(); private static final int RADIUS = 10; private static final float DEG_TO_RAD = (float)(2* /360.0); //Positionals for drawing & angel for circle path private float x, y; private int alpha = 0; public BubblesView(Context context, AttributeSet attrs) { super(context, attrs); //Register class as callback handler for the surface getholder().addcallback((callback) this); //Create a blue/red color for backgrd./bubble backgroundpaint.setcolor(color.blue); bubblepaint.setstyle(paint.style.fill); bubblepaint.setcolor(color.red); //The contructor doesn t draw a view/layout private void drawscreen(canvas c) { //Draw background c.drawrect(0, 0, c.getwidth(), c.getheight(), backgroundpaint); //Draw bubble c.drawoval(new RectF(x-RADIUS, y-radius, x+radius, y+radius), bubblepaint); private void calculatedisplay(canvas canvas) { //Screen is partitiones in 4 segments in x an y final float width = canvas.getwidth()/4; final float height = canvas.getheight()/4; //Circle moves on a circle around screen center x = width * (float)math.cos(alpha * DEG_TO_RAD) + 2 * width; y = height * (float)math.sin(alpha * DEG_TO_RAD) + 2 * height; //Move on to next angle if (alpha < 360) alpha++; else alpha=0; Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 6
7 The BubblesView Display Loop & Timing //Private display loop thread private class GameLoop extends Thread { private long msperframe = 1000/25; //Frame rate public boolean running = true; //Thread run control private long frametime = 0; //Clock to time control private void waittillnextframe() { long nextsleep = 0; //Count frametime on every call frametime += msperframe; //run is the standard routine called, when a thread is //started through the start() method public void run() { Canvas canvas = null; final SurfaceHolder surfaceholder = BubblesView.this.surfaceHolder; frametime = System.currentTimeMillis(); while (running) { try { //Get the canvas exclusively canvas = surfaceholder.lockcanvas(); //Correct frametime value by actually passed ms nextsleep = frametime - System.currentTimeMillis(); if (nextsleep > 0) { //Wait to every msperframe. Keeping the //processing time into account try { sleep(nextsleep); //Try this line instead, if you don't believe // sleep(msperframe); //Must be executed exclusively synchronized (surfaceholder) { //Calculate new frame & draw cycle calculatedisplay(canvas); drawscreen(canvas); finally { if (canvas!= null) surfaceholder. unlockcanvasandpost(canvas); waittillnextframe(); catch (InterruptedException e) { //Nothing being done here //End of private class GameLoop Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 7 ft=st ft+40 ct=st+40 dt=ft-ct=0 no sleep ft: frametime st: starttime ct: currenttime dt: delaytime ft+80 ft+120 ft+160 ft+200 ct=st+75 dt=ft-ct=5 sleep(5) ct=st+130 dt=ft-ct=-10 dt<0 => no sleep ct=st+150 dt=ft-ct=10 sleep(10) ct=st+200 dt=ft-ct=0 no sleep time [ms]
8 The BubblesView - Miscellaneous //Interfcae implementation //Called when display is up public void surfacecreated(surfaceholder holder) { surfaceholder = holder; //Must be executed exclusively synchronized (this) { if (gameloop == null) { //Start animation here gameloop = new GameLoop(); gameloop.start(); //Not used: Called after structural changes // (format or size) have been made to the surface public void surfacechanged( SurfaceHolder holder, int format, int width, int height) { //Called before display will be brought down public void surfacedestroyed(surfaceholder holder) { //Must be executed exclusively synchronized (this) { boolean retry = true; if (gameloop!= null) { //Signal stop request to display loop gameloop.running = false; //Wait until thread joins here while (retry) { try { //Catch the thread gameloop.join(); retry = false; catch (InterruptedException e) { //Void loop in any case gameloop = null; //End of class BubblesView Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 8
9 Creating Bubbles A fine example of using classes and instances Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 9
10 Definition of a Bubble package de.fhkl.gatav.ut.bubbles_0; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.rectf; class Bubble { private float x, y, speed; private static final Paint bubblepaint = new Paint(); //Unusual way to set static prop s of an class static { bubblepaint.setstyle( Paint.Style.FILL); bubblepaint.setcolor(color.cyan); bubblepaint.setalpha(150); bubblepaint.setantialias(true); //Some constants of a Bubble public static final int RADIUS = 10; public static final int MAX_SPEED = 10; public static final int MIN_SPEED = 1; //Constructor init. Start pos. & speed public Bubble (float x, float y, float speed) { this.x = x; this.y = y; this.speed = Math.max(speed, MIN_SPEED); //Simply draw that bubble public void draw(canvas c) { c.drawoval(new RectF(x-RADIUS, y-radius, x+radius, y+radius), bubblepaint); //Speed moves bubble up in any way public void move() { y -= speed; //Test if the Bubble is still visible public boolean outofrange() { return (y+radius < 0); //End of class Bubble Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 10
11 Aus BubblesView.java import java.util.linkedlist; private LinkedList<Bubble> bubbles = new LinkedList<Bubble>(); //Bubble generation rate private float BUBBLE_FREQUENCY = 0.3f; //Constructor is now simplified public BubblesView(Context context, AttributeSet attrs) { super(context, attrs); getholder().addcallback((callback)this); backgroundpaint.setcolor(color.blue); bubblepaint.setstyle(paint.style.fill); bubblepaint.setcolor(color.red); Using Bubble Instances //Calculates next bubble step private void calculatedisplay(canvas canvas) { randomlyaddbubbles(canvas.getwidth(),canvas.getheight()); LinkedList<Bubble> bubblestoremove = new LinkedList<Bubble>(); //Move all bubbles for (Bubble bubble : bubbles) { bubble.move(); //and keep display leavers in mind if (bubble.outofrange()) bubblestoremove.add(bubble); //Remove all bubbled up for (Bubble bubble : bubblestoremove) bubbles.remove(bubble); //Adds a bubble at random. public void randomlyaddbubbles(int screenwidth, int screenheight) { //Create bubble every time the //frame threshold is exceeded if (Math.random()>BUBBLE_FREQUENCY) return; private void drawscreen(canvas c) { c.drawrect(0,0,c.getwidth(),c.getheight(), backgroundpaint); //Draw bubbles for (Bubble bubble : bubbles) { bubble.draw(c); bubbles.add(new Bubble( //x pos at random (int)(screenwidth*math.random()), //y below bottom of screen screenheight+bubble.radius, //This avoids bubbles of speed 0 (int)((bubble.max_speed-0.1) *Math.random()+0.1) )); Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 11
12 Making the Bubbles Looking more Alive Things don t have to act as reality, as long as it looks like reality Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 12
13 package de.fhkl.gatav.ut.bubbles_1; import... More Animation to the Bubbles class Bubble { private float x, y, speed; private static final Paint bubblepaint = new Paint(); static { bubblepaint.setstyle(paint.style.fill); bubblepaint.setcolor(color.cyan); bubblepaint.setalpha(150); bubblepaint.setantialias(true); public static final int RADIUS = 10; public static final int MAX_SPEED = 10; public static final int MIN_SPEED = 1; private float amountofwobble = 0; private static final float DOUBLE_PI = (float)(2* ); public static final float WOBBLE_RATE = (float)8*double_pi; public static final float WOBBLE_AMOUNT = (float)0.05; private float amountofshift = 0; public static final float SHIFT_RATE = (float)50*double_pi; public static final float SHIFT_AMOUNT = 2f; public Bubble(float x, float y, float speed) { this.x = x; this.y = y; this.speed = Math.max(speed, MIN_SPEED); public void draw(canvas c) { float xdeformation = RADIUS*WOBBLE_AMOUNT*amountOfWobble; float ydeformation = RADIUS*WOBBLE_AMOUNT*(1-amountOfWobble); float shift = SHIFT_AMOUNT*amountOfShift; c.drawoval( new RectF(x-(RADIUS+xDeformation)+shift, y-(radius+ydeformation), x+(radius+xdeformation)+shift, y+(radius+ydeformation)), bubblepaint); public void move(canvas c) { y -= speed; amountofwobble = (float)math.cos((y/c.getheight()) *WOBBLE_RATE); amountofshift = (float)math.sin((y/c.getheight()) *SHIFT_RATE*speed/MAX_SPEED); public boolean outofrange() { return (y+radius < 0); //End of class Bubble Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 13
14 package de.fhkl.gatav.ut.bubbles_1; import... More Animation to the Bubbles class Bubble { private float x, y, speed; private static final Paint bubblepaint = new Paint(); static { bubblepaint.setstyle(paint.style.fill); bubblepaint.setcolor(color.cyan); bubblepaint.setalpha(150); bubblepaint.setantialias(true); public static final int RADIUS = 10; public static final int MAX_SPEED = 10; public static final int MIN_SPEED = 1; private float amountofwobble = 0; private static final float DOUBLE_PI = (float)(2* ); public static final float WOBBLE_RATE = (float)8*double_pi; public static final float WOBBLE_AMOUNT = (float)0.05; private float amountofshift = 0; public static final float SHIFT_RATE = (float)50*double_pi; public static final float SHIFT_AMOUNT = 2f; public Bubble(float x, float y, float speed) { this.x = x; this.y = y; this.speed = Math.max(speed, MIN_SPEED); public void draw(canvas c) { float xdeformation = RADIUS*WOBBLE_AMOUNT*amountOfWobble; float ydeformation = RADIUS*WOBBLE_AMOUNT*(1-amountOfWobble); float shift = SHIFT_AMOUNT*amountOfShift; c.drawoval( new RectF(x-(RADIUS+xDeformation)+shift, y-(radius+ydeformation), x+(radius+xdeformation)+shift, y+(radius+ydeformation)), bubblepaint); public void move(canvas c) { y -= speed; amountofwobble = (float)math.cos((y/c.getheight()) *WOBBLE_RATE); amountofshift = (float)math.sin((y/c.getheight()) *SHIFT_RATE*speed/MAX_SPEED); public boolean outofrange() { return (y+radius < 0); //End of class Bubble Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 14
15 The Appearent Look Mad Movies or Things got to get smooth Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 15
16 Things to do for a Smoother Look Simple solution: draw as many frames as possible But be careful, there may be other things to do Exact movement calculation If we don t have fixed logical frames, we need a kind of fractions of a frame From Bubble.java public void move(canvas c, float numberofframes) { //Movement depends on exact time between drawn frames float moveddistance = speed*numberofframes; y -= moveddistance; amountofwobble = (float)math.cos((y/c.getheight())*wobble_rate); amountofshift = (float)math.sin((y/c.getheight()) *SHIFT_RATE*movedDistance/MAX_SPEED); Adjust the rate of bubble generation Since frequently calls to randomlyaddbubbles will create to much bubbles now Necessary: Subframe counting Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 16
17 From BubblesView.java //Generates new, moves, removes unused bubbles private void calculatedisplay(canvas canvas, float numberofframes) { randomlyaddbubbles(canvas.getwidth(), canvas.getheight(), numberofframes); LinkedList<Bubble> bubblestoremove = new LinkedList<Bubble>(); for (Bubble bubble : bubbles) { bubble.move(canvas, numberofframes); if (bubble.outofrange()) bubblestoremove.add(bubble); for (Bubble bubble : bubblestoremove) { bubbles.remove(bubble); Subframe Counting //Adds a bubble at random. //Now: Probability depends prop on the time between frames //Resulting in a more constant bubble generation rate public void randomlyaddbubbles( int screenwidth, int screenheight, float numframes) { //Private display loop thread public void run() { Canvas canvas = null; long thisframetime; long lastframetime = System.currentTimeMillis(); float framessincelastframe; final SurfaceHolder surfaceholder = BubblesView.this.surfaceHolder; frametime = System.currentTimeMillis(); while (running) { try { canvas = surfaceholder.lockcanvas(); synchronized (surfaceholder) { drawscreen(canvas); //Calculate the exact no. of frames since last loop thisframetime = System.currentTimeMillis(); framessincelastframe = (float) (thisframetime-lastframetime)/msperframe; lastframetime = thisframetime; //Create a bubble if numberofframe threshold exceeds if (Math.random()>BUBBLE_FREQUENCY*numFrames) return; bubbles.add(new Bubble( //x pos at random (int)(screenwidth*math.random()), //y pos under bottom of screen screenheight+bubble.radius, //This avoids bubbles of speed 0 (int)((bubble.max_speed-0.1)*math.random()+0.1))); calculatedisplay(canvas, framessincelastframe); finally { if (canvas!= null) surfaceholder.unlockcanvasandpost(canvas); waittillnextframe(); Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 17
18 Making the Audiance Impressed Some minor tricks. Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 18
19 Use a cool pics Background Nice, fancy looking objects From BubblesView.java private Bitmap backgroundbitmap; private Bitmap bubblebitmap; Simple but Effective Tricks //Constructor public BubblesView(Context context, AttributeSet attrs) { super(context, attrs); backgroundbitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.aquarium); bubblebitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.bubble); private void drawscreen(canvas c) { Rect nullrect = null; Paint nullpaint = null; c.drawbitmap(backgroundbitmap, nullrect, new RectF(0,0,c.getWidth(),c.getHeight()), nullpaint); From Bubble.java method draw c.drawbitmap(bubblebitmap, nullrect, new RectF(x-(RADIUS+xDeformation)+shift, y-(radius+ydeformation), x+(radius+xdeformation)+shift, y+(radius+ydeformation)), nullpaint); Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 19 The bubble is drawn on a transparent background
20 Now it up to you. Your exercise. We hope it won t be a rainy day to you Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 20
21 Always keep in mind: Things don t have to behave physically correct, but it should look like that THANK YOU FOR YOUR ATTENTION! Graphical Apps - The Android View: Prof. Dr. Bender, Prof. Dr. Tronnier 21
package import import import import import import import public class extends public void super new this class extends public super public void new
Android 2-D Drawing Android uses a Canvas object to host its 2-D drawing methods. The program below draws a blue circle on a white canvas. It does not make use of the main.xml layout but draws directly
More informationCustom Views in Android Tutorial
Custom Views in Android Tutorial The Android platform provides an extensive range of user interface items that are sufficient for the needs of most apps. However, there may be occasions on which you feel
More information1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.
1 카메라 1.1 제어절차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1.2 관련주요메서드 setpreviewdisplay() : startpreview() : stoppreview(); onpicturetaken() : 사진을찍을때자동으로호출되며캡처한이미지가전달됨 1.3 제작철차 Step 1 프로젝트를생성한후매니페스트에퍼미션들을설정한다.
More informationAndroid Apps Development for Mobile Game Lesson Create a simple paint brush that allows user to draw something (Page 11 13)
Workshop 1. Create a simple Canvas view with simple drawing (Page 1 5) Hide Action Bar and Status Bar Create Canvas View Create Simple Drawing 2. Create a simple animation (Page 6 10) Load a simple image
More informationApp Development for Smart Devices. Lec #7: Audio, Video & Telephony Try It Out
App Development for Smart Devices CS 495/595 - Fall 2013 Lec #7: Audio, Video & Telephony Try It Out Tamer Nadeem Dept. of Computer Science Trt It Out Example - SoundPool Example - VideoView Page 2 Fall
More informationMobile Application (Design and) Development
Mobile Application (Design and) Development 7 th class Prof. Stephen Intille s.intille@neu.edu Northeastern University 1 Q&A Workspace setup in lab. Anyone try it? Anyone looking for a partner? Boggle
More informationThread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables.
1 Thread A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables. Each virtual machine instance has at least one main
More informationVienos veiklos būsena. Theory
Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is
More informationANDROID (4) 2D Graphics and Animation, Handling Screen Rotation. Marek Piasecki
ANDROID (4) 2D Graphics and Animation, Handling Screen Rotation Marek Piasecki Outline 2D graphics drawing Color / Paint / Canvas XML drawable (from resources) direct to a Canvas / View.onDraw() 2D animation
More informationDatabase Development In Android Applications
ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Database Development In Android Applications 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran
More informationOPTIMIZING ANDROID UI PRO TIPS FOR CREATING SMOOTH AND RESPONSIVE APPS
OPTIMIZING ANDROID UI PRO TIPS FOR CREATING SMOOTH AND RESPONSIVE APPS @CYRILMOTTIER GET TO KNOW JAVA DON T USE BOXED TYPES UNNECESSARILY HashMap hashmap = new HashMap();
More informationEmbedded Systems Programming - PA8001
Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 9 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering
More informationGraphics. Lecture 16
Graphics Lecture 16 Graph Library Draw a Graph, draw a chart, google Android Library draw graph/ chart GraphView library information can be found at http://www.android-graphview.org/ Add it to your build.gradle:
More informationManifest.xml. Activity.java
Dr.K.Somasundaram Ph.D Professor Department of Computer Science and Applications Gandhigram Rural Institute, Gandhigram, Tamil Nadu-624302, India ka.somasundaram@gmail.com Manifest.xml
More informationProgramming of Mobile Services, Spring 2012
Programming of Mobile Services, Spring 2012 HI1017 Lecturer: Anders Lindström, anders.lindstrom@sth.kth.se Lecture 6 Today s topics Android graphics - Views, Canvas, Drawables, Paint - Double buffering,
More informationGraphics Support in Android
Graphics Support in Android Android and Graphics The Android pla4orm supports both 2D and 3D graphics: 2D graphics is powered by a custom library High performance 3D graphics is based on the OpenGL ES
More information+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.
+ Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create
More information<uses-permission android:name="android.permission.internet"/>
Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia framework
More informationandroid:orientation="horizontal" android:layout_margintop="30dp"> <Button android:text="button2"
Parametrų keitimas veikiančioje aplikacijoje Let s create a project: Project name: P0181_DynamicLayout3 Build Target: Android 2.3.3 Application name: DynamicLayout3 Package name: ru.startandroid.develop.dynamiclayout3
More information8/30/15 MOBILE COMPUTING. CSE 40814/60814 Fall How many of you. have implemented a command-line user interface?
MOBILE COMPUTING CSE 40814/60814 Fall 2015 How many of you have implemented a command-line user interface? 1 How many of you have implemented a graphical user interface? HTML/CSS Java Swing.NET Framework
More informationAndroid 101: How to draw on a SurfaceView and handle touch events. Richard A. Perez Android 101
Android 101: How to draw on a SurfaceView and handle touch events. Richard A. Perez Android 101 Table of Contents Introduction... 3 Android Manifest... 4 Package... 4 Version... 4 Uses SDK... 4 Declare
More informationAndroid Workshop: Model View Controller ( MVC):
Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software
More informationFigure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.
44 CHAPTER 2 Android s development environment Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. TIP You ll want the package name of your applications to be unique
More informationAction Bar. (c) 2010 Haim Michael. All Rights Reserv ed.
Action Bar Introduction The Action Bar is a widget that is shown on top of the screen. It includes the application logo on its left side together with items available from the options menu on the right.
More informationApp Development for Smart Devices. Lec #18: Advanced Topics
App Development for Smart Devices CS 495/595 - Fall 2011 Lec #18: Advanced Topics Tamer Nadeem Dept. of Computer Science Objective Web Browsing Android Animation Android Backup Presentation - Developing
More informationTerms: MediaPlayer, VideoView, MediaController,
Terms: MediaPlayer, VideoView, MediaController, Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in Phone: +91-9999-283-283
More informationAndroid Development Tutorial
Android Development Tutorial Part II Human-Computer Interaction (COMP 4020) Winter 2013 2 Canvas Example public class CanvasApp extends Activity @Override protected void oncreate(bundle savedinstancestate)
More informationReal-Time Embedded Systems
Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones
More informationMeniu. Create a project:
Meniu Create a project: Project name: P0131_MenuSimple Build Target: Android 2.3.3 Application name: MenuSimple Package name: ru.startandroid.develop.menusimple Create Activity: MainActivity Open MainActivity.java.
More informationIntents. Your first app assignment
Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work
More informationACS-1805 Introduction to Programming (with App Inventor)
ACS-1805 Introduction to Programming (with App Inventor) Chapter 8 Creating Animated Apps 10/25/2018 1 What We Will Learn The methods for creating apps with simple animations objects that move Including
More informationEmbedded Systems Programming - PA8001
Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering
More informationAndroid Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)
Android Specifics Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics ArrayAdapter Preferences Widgets Jonathan Diehl, Hendrik Thüs 2 ArrayAdapter Jonathan Diehl, Hendrik Thüs
More informationTheme 2 Program Design. MVC and MVP
Theme 2 Program Design MVC and MVP 1 References Next to the books used for this course, this part is based on the following references: Interactive Application Architecture Patterns, http:// aspiringcraftsman.com/2007/08/25/interactiveapplication-architecture/
More informationA Crash Course to Android Mobile Platform
Enterprise Application Development using J2EE Shmulik London Lecture #2 A Crash Course to Android Mobile Platform Enterprise Application Development Using J2EE / Shmulik London 2004 Interdisciplinary Center
More informationStarting Another Activity Preferences
Starting Another Activity Preferences Android Application Development Training Xorsat Pvt. Ltd www.xorsat.net fb.com/xorsat.education Outline Starting Another Activity Respond to the Button Create the
More informationArrays of Buttons. Inside Android
Arrays of Buttons Inside Android The Complete Code Listing. Be careful about cutting and pasting.
More informationContents at a Glance. iii.
For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...ix
More informationAndroid HelloWorld - Example. Tushar B. Kute,
Android HelloWorld - Example Tushar B. Kute, http://tusharkute.com Anatomy of Android Application Anatomy of Android Application Java This contains the.java source files for your project. By default, it
More informationMastering Android Drawables
Cyril Mottier Mastering Android Drawables Drawable are powerful so use them! Global note 2 Introduction Drawables 101 3 Introduction What s a Drawable? 4 Introduction What s a Drawable? Entity that can
More informationGATAV 9. Goodby flatland Welcome to 3D!
GATAV 9. Goodby flatland Welcome to 3D! TOC 1. OpenGL ES the 3D-API 2. The buffer concept - a technical necessity 3. Introducing GLSurfaceView the 3D-View 4. GLSurfaceView.Renderer the interface to 3D-content
More informationAndroid Coding. Dr. J.P.E. Hodgson. August 23, Dr. J.P.E. Hodgson () Android Coding August 23, / 27
Android Coding Dr. J.P.E. Hodgson August 23, 2010 Dr. J.P.E. Hodgson () Android Coding August 23, 2010 1 / 27 Outline Starting a Project 1 Starting a Project 2 Making Buttons Dr. J.P.E. Hodgson () Android
More informationCOMP4521 EMBEDDED SYSTEMS SOFTWARE
COMP4521 EMBEDDED SYSTEMS SOFTWARE LAB 1: DEVELOPING SIMPLE APPLICATIONS FOR ANDROID INTRODUCTION Android is a mobile platform/os that uses a modified version of the Linux kernel. It was initially developed
More informationPractical 1.ListView example
Practical 1.ListView example In this example, we show you how to display a list of fruit name via ListView. Android Layout file File : res/layout/list_fruit.xml
More informationEMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State
EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Saving State THE PROBLEM How to save the state (of a UI, for instance) so that it survives even when the application is closed/killed The state should
More informationAndroid Services. Victor Matos Cleveland State University. Services
22 Android Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 22. Android Android A Service is an application component that runs in
More informationSmoother Graphics Taking Control of Painting the Screen
It is very likely that by now you ve tried something that made your game run rather slow. Perhaps you tried to use an image with a transparent background, or had a gazillion objects moving on the window
More informationDesigning Apps Using The WebView Control
28 Designing Apps Using The Control Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html The Busy Coder's Guide to Advanced Android Development
More informationComputer Science E-76 Building Mobile Applications
Computer Science E-76 Building Mobile Applications Lecture 3: [Android] The SDK, Activities, and Views February 13, 2012 Dan Armendariz danallan@mit.edu 1 http://developer.android.com Android SDK and NDK
More informationMAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.
MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;
More informationAndroid Data Storage
Lesson 14 Android Persistency: Victor Matos Cleveland State University Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright 2008-2009 CommonsWare, LLC. ISBN: 978-0-9816780-0-9
More informationHow We Implemented PullToMakeSoup Animation for Android
How We Implemented PullToMakeSoup Animation for Android A year ago our Yalantis team built PullToMakeSoup pull to refresh animation for ios. You can go check it out along with our other libraries on Yalantis
More informationUser Interface Development. CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr.
User Interface Development CSE 5236: Mobile Application Development Instructor: Adam C. Champion Course Coordinator: Dr. Rajiv Ramnath 1 Outline UI Support in Android Fragments 2 UI Support in the Android
More informationApp Development for Smart Devices. Lec #8: Android Sensors
App Development for Smart Devices CS 495/595 - Fall 2011 Lec #8: Android Sensors Tamer Nadeem Dept. of Computer Science Some slides adapted from Stephen Intille Objective Android Sensors Sensor Manager
More informationLearn about Android Content Providers and SQLite
Tampa Bay Android Developers Group Learn about Android Content Providers and SQLite Scott A. Thisse March 20, 2012 Learn about Android Content Providers and SQLite What are they? How are they defined?
More informationMobile Computing Practice # 2c Android Applications - Interface
Mobile Computing Practice # 2c Android Applications - Interface One more step in the restaurants application. 1. Design an alternative layout for showing up in landscape mode. Our current layout is not
More information10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics
Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic
More informationGetting started: Installing IDE and SDK. Marco Ronchetti Università degli Studi di Trento
Getting started: Installing IDE and SDK Marco Ronchetti Università degli Studi di Trento Alternative: Android Studio http://developer.android.com/develop/index.html 2 Tools behind the scenes dx allows
More informationMobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.
Simple Android Application for Native Calculator Aim: To develop a Simple Android Application for Native Calculator. Procedure: Creating a New project: Open Android Stdio and then click on File -> New
More informationINTRODUCTION TO ANDROID
INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android
More informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2015 Name: This exam consists of 5 problems on the following 7 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More informationKotlin for wearables: use case. Andrey Mukamolov
Kotlin for wearables: use case Andrey Mukamolov Domain Dota 2 is a competitive MOBA game A lot of fans and money Most toxic community Dota 2 Dota 2 heroes Dota 2 MMR Wear OS by Google
More informationEMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation
EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are
More informationMobile Programming Lecture 5. Composite Views, Activities, Intents and Filters
Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or
More informationCreate Parent Activity and pass its information to Child Activity using Intents.
Create Parent Activity and pass its information to Child Activity using Intents. /* MainActivity.java */ package com.example.first; import android.os.bundle; import android.app.activity; import android.view.menu;
More informationelse if(rb2.ischecked()) {
Problem :Toy Calculator Description:Please design an Android application that contains 2 activities: cal_main and cal_result. The following figure is a suggested layout for the cal_main activity. For the
More informationOperator s Manual. minibht Audiometry Android App. Team 2. Samir Dahmani, Nihit Mody, Joseph Wolanski. Client: Dr. Oliver
Operator s Manual minibht Audiometry Android App Team 2 Samir Dahmani, Nihit Mody, Joseph Wolanski Client: Dr. Oliver Farmington, CT UConn Health Center Table Of Contents: 1 Introduction 1.1 General Overview
More informationACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi
ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi View System A system for organizing GUI Screen = tree of views. View = rectangular shape on the screen that knows how to draw itself wrt to the containing
More informationNotification mechanism
Notification mechanism Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created
More informationCreate a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks.
CIS 470 Lesson 13 Databases - Quick Notes Create a local SQL database hosting a CUSTOMER table. Each customer includes [id, name, phone]. Do the work inside Threads and Asynctasks. package csu.matos; import
More informationMobile Computing Fragments
Fragments APM@FEUP 1 Fragments (1) Activities are used to define a full screen interface and its functionality That s right for small screen devices (smartphones) In bigger devices we can have more interface
More informationAndroid. Soft Keyboard Graphics and Media
Android Soft Keyboard Graphics and Media Soft keyboards Devices can have hard keyboards or only a directional pad (arrows plus select) But most don t have keyboards All have soft keyboards controlled by
More informationDomain-Driven Design Activity
Domain-Driven Design Activity SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology Entities and Value Objects are special types of objects
More informationCSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015
CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything
More informationSolving an Android Threading Problem
Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know
More informationIntroduction to Android Development
Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,
More informationSecurity model. Marco Ronchetti Università degli Studi di Trento
Security model Marco Ronchetti Università degli Studi di Trento Security model 2 Android OS is a multi-user Linux in which each application is a different user. By default, the system assigns each application
More informationAndroid Beginners Workshop
Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999
More informationProgramming Fundamentals
Programming Fundamentals Lecture 03 Introduction to Löve 2D Edirlei Soares de Lima Computer Graphics Concepts What is a pixel? In digital imaging, a pixel is a single
More informationIntroduction to Mobile Application Development Using Android Week Four Video Lectures
Introduction to Mobile Application Development Using Android Week Four Video Lectures Week Four: Lecture 1: Unit 1: Multimedia Multimedia Support in Android Multimedia Support in Android We are now going
More informationCS 4330/5390: Mobile Application Development Exam 1
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.
More information(SSOL) Simple Shape Oriented Language
(SSOL) Simple Shape Oriented Language Madeleine Tipp Jeevan Farias Daniel Mesko mrt2148 jtf2126 dpm2153 Description: SSOL is a programming language that simplifies the process of drawing shapes to SVG
More informationSaving application preferences
Saving application preferences Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work
More informationEMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches
EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI Specification: Approaches UIS: APPROACHES Programmatic approach: UI elements are created inside the application code Declarative approach: UI elements are listed
More informationpublic AnimLayer(Context context, AttributeSet attrs, int defstyle) { super(context, attrs, defstyle); initlayer(); }
AnimLayer.java package com.kyindo.game; import java.util.arraylist; import java.util.list; import android.content.context; import android.util.attributeset; import android.view.view; import android.view.animation.animation;
More informationCS260 Intro to Java & Android 09.AndroidAdvUI (Part I)
CS260 Intro to Java & Android 09.AndroidAdvUI (Part I) Winter 2015 Winter 2015 CS260 - Intro to Java & Android 1 Creating TicTacToe for Android We are going to begin to use everything we ve learned thus
More informationITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences
ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Shared Preferences 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran Tanveer, ITU Experts
More informationAndroid Using Menus. Victor Matos Cleveland State University
8 Android Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright 2008-2009 CommonsWare, LLC. ISBN: 978-0-9816780-0-9 & Android Developers http://developer.android.com/index.html
More informationMobile Image Processing
Mobile Image Processing Part 1: Introduction to mobile image processing on Android" Part 2: Real-time augmentation of viewfinder frames" Part 3: Utilizing optimized functions in the OpenCV library" Digital
More informationComposite Pattern Diagram. Explanation. JavaFX Subclass Hierarchy, cont. JavaFX: Node. JavaFX Layout Classes. Top-Level Containers 10/12/2018
Explanation Component has Operation( ), which is a method that applies to all components, whether composite or leaf. There are generally many operations. Component also has composite methods: Add( ), Remove(
More informationLecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.
CSCE 315: Android Lectures (1/2) Dr. Jaerock Kwon App Development for Mobile Devices Jaerock Kwon, Ph.D. Assistant Professor in Computer Engineering App Development for Mobile Devices Jaerock Kwon, Ph.D.
More informationMobile Image Processing
Mobile Image Processing Examples of mobile image processing Android platform Class resources for Android Eclipse integrated development environment Augmentation of viewfinder frames Debugging with DDMS
More informationFrTime: A Language for Reactive Programs
FrTime: A Language for Reactive Programs Version 5.3.6 Greg Cooper August 9, 2013 #lang frtime The frtime language supports declarative construction of reactive systems in a syntax very similar to that
More informationCMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts
CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts The goal of this Python programming assignment is to write your own code inside a provided program framework, with some new graphical
More informationThe Nervous Shapes Example
The Nervous Shapes Example This Example is taken from Dr. King s Java book 1 11.6 Abstract Classes Some classes are purely artificial, created solely so that subclasses can take advantage of inheritance.
More informationApplications. Marco Ronchetti Università degli Studi di Trento
Applications Marco Ronchetti Università degli Studi di Trento Android Applications An Android application typically consists of one or more related, loosely bound activities for the user to interact with.
More informationFragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment
FRAGMENTS Fragments An activity is a container for views When you have a larger screen device than a phone like a tablet it can look too simple to use phone interface here. Fragments Mini-activities, each
More informationAndroid Application Model I
Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath Reading: Big Nerd Ranch Guide, Chapters 3, 5 (Activities);
More informationAdapter.
1 Adapter An Adapter object acts as a bridge between an AdapterView and the underlying data for that view The Adapter provides access to the data items The Adapter is also responsible for making a View
More informationLifeStreet Media Android Publisher SDK Integration Guide
LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM
More information