Initialising the Views (GameFragment) 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 5: Ultimate Tic-Tac-Toe Game: The Interface (Part III)
|
|
- John Dickerson
- 5 years ago
- Views:
Transcription
1 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 5: Ultimate Tic-Tac-Toe Game: The Interface (Part III) Dr Dimitris C. Dracopoulos Making a Move (GameFragment) Dimitris C. Dracopoulos 1/22 Initialising the Views (GameFragment) private void initviews ( View rootview ) { mentireboard. setview ( rootview ); View outer = rootview. findviewbyid ( mlargeids [ large ]); mlargetiles [ large ]. setview ( outer ); ImageButton inner = ( ImageButton ) outer. findviewbyid ( msmallids [ small ]); final int flarge = large ; final int fsmall = small ; final Tile smalltile = msmalltiles [ large ][ small ]; smalltile. setview ( inner ); inner. setonclicklistener ( new View. OnClickListener () public void onclick ( View view ) { if ( isavailable ( smalltile )) { makemove ( flarge, fsmall ); switchturns (); ); Dimitris C. Dracopoulos 2/22 Switching turns and Updating All Tiles (GameFragment) private void makemove ( int large, int small ) { mlastlarge = large ; mlastsmall = small ; Tile smalltile = msmalltiles [ large ][ small ]; Tile largetile = mlargetiles [ large ]; smalltile. setowner ( mplayer ); setavailablefromlastmove ( small ); Tile. Owner oldwinner = largetile. getowner (); Tile. Owner winner = largetile. findwinner (); if ( winner!= oldwinner ) { largetile. setowner ( winner ); winner = mentireboard. findwinner (); mentireboard. setowner ( winner ); updatealltiles (); if ( winner!= Tile. Owner. NEITHER ) { (( GameActivity ) getactivity ()). reportwinner ( winner ); private void switchturns () { mplayer = mplayer == Tile. Owner.X? Tile. Owner.O : Tile. Owner.X; private void updatealltiles () { mentireboard. updatedrawablestate (); mlargetiles [ large ]. updatedrawablestate (); msmalltiles [ large ][ small ]. updatedrawablestate (); Dimitris C. Dracopoulos 3/22 Dimitris C. Dracopoulos 4/22
2 Restarting the Game (GameFragment) Saving the State of the Game (GameFragment) Need to convert the state of the game to a string: public void restartgame () { initgame (); initviews ( getview ()); updatealltiles (); public String getstate () { StringBuilder builder = new StringBuilder (); builder. append ( mlastlarge ); builder. append (, ); builder. append ( mlastsmall ); builder. append (, ); builder. append ( msmalltiles [ large ][ small ]. getowner (). name ()); builder. append (, ); return builder. tostring (); Dimitris C. Dracopoulos 5/22 Restoring the State of the Game (GameFragment) Saving Data in an Android Application Dimitris C. Dracopoulos 6/22 /* * Restore the state of the game from the given string. */ public void putstate ( String gamedata ) { String [] fields = gamedata. split (","); int index = 0; mlastlarge = Integer. parseint ( fields [ index ++]); mlastsmall = Integer. parseint ( fields [ index ++]); Tile. Owner owner = Tile. Owner. valueof ( fields [ index ++]); msmalltiles [ large ][ small ]. setowner ( owner ); Saving Key-Value Sets (small amounts) Saving in Files Saving in SQL databases (large amounts of structured data) setavailablefromlastmove ( mlastsmall ); updatealltiles (); Dimitris C. Dracopoulos 7/22 Dimitris C. Dracopoulos 8/22
3 Saving Key-Value Sets Using the SharedPreferences API. To create a new shared preference file or access an existing one, call one of the following methods to get a SharedPreferences object: getsharedpreferences(): if you need multiple shared preferences files (the name of the preference file is the first argument) - can be called from any Context in the app Context context = getactivity (); SharedPreferences sharedpref = context. getsharedpreferences ( preference_ filename, getpreferences(): call from an activity to use only one shared preference file associated with the activity SharedPreferences sharedpref = getactivity (). getpreferences ( Usage of MODE WORLD READABLE or MODE WORLD WRITEABLE imply that any other app can access your data (if it knows the filename) Dimitris C. Dracopoulos 9/22 Saving Key-Value Sets (Reading Shared Preferences) Saving Key-Value Sets (Writing to Shared Preferences) 1. Create a SharedPreferences.Editor by calling edit() on SharedPreferences. 2. Write the keys and values with putint(), putstring(), etc. 3. Call commit(). SharedPreferences sharedpref = getactivity (). getpreferences ( SharedPreferences. Editor editor = sharedpref. edit (); // step 1 editor. putint ( key_name, newhighscore ); // step 2 editor. commit (); // step 3 Continuing a Game (GameActivity) Dimitris C. Dracopoulos 10/22 public static final String KEY_ RESTORE = " key_ restore "; public static final String PREF_ RESTORE = " pref_ restore "; Call methods getint(), getstring(), etc., providing the key of the value you want to retrieve. SharedPreferences sharedpref = getactivity (). getpreferences ( long highscore = sharedpref. getint ( key_name, defaultvalue ); The second argument defaultvalue is optional and it is value that will be returned if the key key name is not present. private GameFragment mgamefragment ; protected void oncreate ( Bundle savedinstancestate ) { super. oncreate ( savedinstancestate ); setcontentview ( R. layout. activity_ game ); mgamefragment = ( GameFragment ) getfragmentmanager (). findfragmentbyid (R.id. fragment_game ); boolean restore = getintent (). getbooleanextra ( KEY_RESTORE, false ); if ( restore ) { String gamedata = getpreferences ( MODE_ PRIVATE ). getstring ( PREF_RESTORE, null ); if ( gamedata!= null ) { mgamefragment. putstate ( gamedata ); Dimitris C. Dracopoulos 11/22 Dimitris C. Dracopoulos 12/22
4 Continuing a Game (GameActivity) (cont ed) protected void onpause () { super. onpause (); String gamedata = mgamefragment. getstate (); getpreferences ( MODE_ PRIVATE ). edit (). putstring ( PREF_RESTORE, gamedata ). commit (); public void restartgame () { mgamefragment. restartgame (); Controlling the Game (cont ed) Dimitris C. Dracopoulos 13/22 Controlling the Game Add 2 buttons for Restart and Main Menu in file res/layout/fragment control.xml: < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " xmlns:tools =" http: // schemas. android. com / tools " android: orientation =" horizontal " android: padding / control_ padding " tools:context =". GameActivity "> android:id ="@+id/ button_restart " android: drawabletop drawable / restart " android:text / restart_label "/> android:id ="@+id/ button_main " android: drawabletop drawable / home " android:text / main_menu_label "/> </ LinearLayout > The Java code for the Control Fragment Dimitris C. Dracopoulos 14/22 package org. example. tictactoe ; Add 2 images home.png and restart.png in the res/drawable-xxhdpi directory. Add the control fragment in the layout of activity game.xml. <! -- Control fragment goes here... --> < fragment android:id ="@+id/ fragment_game_controls " class =" org. example. tictactoe. ControlFragment " tools:layout / fragment_control "/> import android. app. Fragment ; import android.os. Bundle ; import android. view. LayoutInflater ; import android. view. View ; import android. view. ViewGroup ; public class ControlFragment extends Fragment { public View oncreateview ( LayoutInflater inflater, ViewGroup container, Bundle savedinstancestate ) { View rootview = inflater. inflate ( R. layout. fragment_control, container, false ); View main = rootview. findviewbyid ( R. id. button_ main ); View restart = rootview. findviewbyid ( R. id. button_ restart ); Dimitris C. Dracopoulos 15/22 Dimitris C. Dracopoulos 16/22
5 The Java code for the Control Fragment (cont ed) Missing values In dimens.xml: main. setonclicklistener ( new View. OnClickListener () public void onclick ( View view ) { getactivity (). finish (); ); restart. setonclicklistener ( new View. OnClickListener () public void onclick ( View view ) { (( GameActivity ) getactivity ()). restartgame (); ); return rootview ; <dimen name =" activity_horizontal_margin ">8dp </ dimen > <dimen name =" activity_vertical_margin ">8dp </ dimen > <dimen name =" tile_size ">30 dp </ dimen > <dimen name =" tile_margin ">0dp </ dimen > <dimen name =" tile_padding ">3dp </ dimen > <dimen name =" control_padding ">20 dp </ dimen > <dimen name =" small_board_padding ">2dp </ dimen > <dimen name =" small_board_margin ">2dp </ dimen > <dimen name =" elevation_low ">4dp </ dimen > In colors.xml: <color name =" dark_border_color ">#4 f4f4f </ color > <color name =" available_color ">#7 fbf7f </ color > <color name =" blue_color ">#7 f7fff </ color > <color name =" gray_color "># bfbfbf </ color > <color name =" purple_color ">#7 f007f </ color > <color name =" red_color "># ff7f7f </ color > Dimitris C. Dracopoulos 17/22 Dimitris C. Dracopoulos 18/22 Missing values (cont ed) In strings.xml: < string name =" restart_label ">Restart </ string > < string name =" main_menu_label ">Main Menu </ string > < string name =" declare_winner ">%1$ s is the winner </ string > Dealing with landscape mode Define different layouts in the directory res/layout-land: e.g. file activity game.xml < FrameLayout xmlns:android =" http: // schemas. android. com / apk / res / android " xmlns:tools =" http: // schemas. android. com / tools " android: layout_ height =" match_ parent " tools: context =". TicTacToeActivity " > < ImageView android: layout_ height =" match_ parent " android: scaletype =" centercrop " android:src / sandy_beach "/> < LinearLayout android: layout_ height =" match_ parent " android: gravity =" center " android: baselinealigned =" false " android: orientation =" horizontal " > Dimitris C. Dracopoulos 19/22 Dimitris C. Dracopoulos 20/22
6 Dealing with landscape mode (cont ed) < fragment android:id fragment_game " class =" org. example. tictactoe. GameFragment " tools:layout / fragment_game "/> < fragment android:id ="@+id/ fragment_game_controls " class =" org. example. tictactoe. ControlFragment " tools:layout / fragment_control "/> </ LinearLayout > </ FrameLayout > Dimitris C. Dracopoulos 21/22 Dealing with landscape mode (cont ed) The res/layout-land/fragment control.xml file: < LinearLayout xmlns:android =" http: // schemas. android. com / apk / res / android " xmlns:tools =" http: // schemas. android. com / tools " android: orientation =" vertical " android: padding / control_ padding " tools:context =". GameActivity "> android:id ="@+id/ button_restart " android: drawabletop drawable / restart " android:text / restart_label "/> android:id ="@+id/ button_main " android: drawabletop drawable / home " android:text / main_menu_label "/> </ LinearLayout > Dimitris C. Dracopoulos 22/22
The drawable/tile empty.xml file
The X and O Symbols 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 3: Ultimate Tic-Tac-Toe Game: The Interface Dr Dimitris C. Dracopoulos Create them with the filenames x blue.png and o red.png in an
More informationO X X X O O X O X. Tic-Tac-Toe. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 2: The Ultimate Tic-Tac-Toe Game
Tic-Tac-Toe 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 2: The Ultimate Tic-Tac-Toe Game Dr Dimitris C. Dracopoulos O X X X O O X O X The Ultimate Tic-Tac-Toe: Rules of the Game Dimitris C. Dracopoulos
More informationThis lecture. The BrowserIntent Example (cont d)
This lecture 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 10: Working with the Web Browser Dr Dimitris C. Dracopoulos Android provides a full-featured web browser based on the Chromium open source
More informationSQLite. 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases. What is a Database Server. Advantages of SQLite
SQLite 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 6: Working with Databases Dr Dimitris C. Dracopoulos SQLite is a tiny yet powerful database engine. Besides Android, it can be found in: Apple iphone
More informationLab 1 - Setting up the User s Profile UI
Lab 1 - Setting up the User s Profile UI Getting started This is the first in a series of labs that allow you to develop the MyRuns App. The goal of the app is to capture and display (using maps) walks
More informationThe Suggest Example layout (cont ed)
Using Web Services 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 7: Working with Web Services Android provides a full set of Java-standard networking APIs, such as the java.net package containing among
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 informationFragments. Lecture 11
Fragments Lecture 11 Situational layouts Your app can use different layouts in different situations Different device type (tablet vs. phone vs. watch) Different screen size Different orientation (portrait
More informationAndroid User Interface
Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 Android User Interface 2 Multi-Language Support 3 Summary Matthias Keil Android
More informationFragments. Lecture 10
Fragments Lecture 10 Situa2onal layouts Your app can use different layouts in different situa2ons Different device type (tablet vs. phone vs. watch) Different screen size Different orienta2on (portrait
More informationAndroid User Interface Android Smartphone Programming. Outline University of Freiburg
Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 2 Multi-Language Support 3 Summary Matthias Keil 20. Oktober 2014 2 / 19 From
More informationMobile Development Lecture 10: Fragments
Mobile Development Lecture 10: Fragments Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Elgayyar.weebly.com Situational Layouts Your app can use different layout in different situations: different device type
More informationListView Containers. Resources. Creating a ListView
ListView Containers Resources https://developer.android.com/guide/topics/ui/layout/listview.html https://developer.android.com/reference/android/widget/listview.html Creating a ListView A ListView is a
More informationAndroid App Development. Mr. Michaud ICE Programs Georgia Institute of Technology
Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based
More informationSpring Lecture 5 Lecturer: Omid Jafarinezhad
Mobile Programming Sharif University of Technology Spring 2016 - Lecture 5 Lecturer: Omid Jafarinezhad Storage Options Android provides several options for you to save persistent application data. The
More informationLab 3. Accessing GSM Functions on an Android Smartphone
Lab 3 Accessing GSM Functions on an Android Smartphone 1 Lab Overview 1.1 Goals The objective of this practical exercise is to create an application for a smartphone with the Android mobile operating system,
More informationCS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu
CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu Administrivia Moved back deadlines for projects 2, 3 and final project See updated schedule
More informationCS 193A. Activity state and preferences
CS 193A Activity state and preferences This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. Activity instance
More informationCE881: Mobile & Social Application Programming
CE881: Mobile & Social Application Programming, s, s and s Jialin Liu Senior Research Officer Univerisity of Essex 6 Feb 2017 Recall of lecture 3 and lab 3 :) Please download Kahoot or open a bowser and
More informationMultiple devices. Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers
Multiple devices Multiple devices Use wrap_content and match_parent Use RelativeLayout/ConstraintLayout Use configuration qualifiers Create a new directory in your project's res/ and name it using the
More informationMobile Development Lecture 11: Activity State and Preferences
Mobile Development Lecture 11: Activity State and Preferences Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Elgayyar.weebly.com Activity Instance State Instance state: Current state of an activity. Which boxes
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 informationCS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu
CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming Emmanuel Agu Android Apps: Big Picture UI Design using XML UI design code (XML) separate from the program (Java) Why?
More informationOrientation & Localization
Orientation & Localization Overview Lecture: Open Up Your My Pet App Handling Rotations Serializable Landscape Layouts Localization Alert Dialogs 1 Handling Rotations When the device is rotated, the device
More informationSteps to create a Tic-Tac-Toe game Part 2
Steps to create a Tic-Tac-Toe game Part 2 Let's fix a couple of things before moving on. The computer only makes one move, so correct that by updating the Board.setSelectedCell method as follows: public
More informationAnnouncements. Android: n-puzzle Walkthrough. Tommy MacWilliam. Dynamic GUIs. ListViews. Bitmaps. Gameplay. Saving State. Menus
Harvard University February 22, 2012 Announcements Lecture videos: https://www.cs76.net/lectures Section videos: https://www.cs76.net/sections videos: https://www.cs76.net/projects Today dynamic GUIs bitmaps
More informationEMBEDDED SYSTEMS PROGRAMMING UI and Android
EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI and Android STANDARD GESTURES (1/2) UI classes inheriting from View allow to set listeners that respond to basic gestures. Listeners are defined by suitable interfaces.
More informationCS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu Android UI Design Example GeoQuiz App Reference: Android Nerd Ranch, pgs 1 30 App presents
More informationSoftware Engineering Large Practical: Preferences, storage, and testing
Software Engineering Large Practical: Preferences, storage, and testing Stephen Gilmore (Stephen.Gilmore@ed.ac.uk) School of Informatics November 9, 2016 Contents A simple counter activity Preferences
More informationCS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu Android Activity LifeCycle Starting Activities Android applications don't start with a call to main(string[])
More informationGUI Design for Android Applications
GUI Design for Android Applications SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November
More informationFragments and the Maps API
Fragments and the Maps API Alexander Nelson October 6, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Fragments Fragments Fragment A behavior or a portion of a user
More informationCMSC 436 Lab 10. App Widgets and Supporting Different Devices
CMSC 436 Lab 10 App Widgets and Supporting Different Devices Overview For this lab you will create an App Widget that uses a Configuration Activity You will also localize the widget to support different
More informationANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)
ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Application Components Hold the content of a message (E.g. convey a request for an activity to present an image) Lecture 2: Android Programming
More informationMobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling
Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling Lecture 1 Review How to edit XML files in Android Studio? What holds all elements (Views) that appear to the user in an Activity?
More informationProduced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology
Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie User Interface Design" & Development -
More informationTablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time
Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time The 1 activity 1 thing the user can do heuristic may not make sense for larger devices Application
More informationUpon completion of the second part of the lab the students will have:
ETSN05, Fall 2017, Version 2.0 Software Development of Large Systems Lab 2 1. INTRODUCTION The goal of lab 2 is to introduce students to the basics of Android development and help them to create a starting
More informationResponsive mobile design in practice. Kirill Grouchnikov Android, Google Inc.
Responsive mobile design in practice Kirill Grouchnikov Android, Google Inc. this talk is about minimizing the pain of developing for multiple form factors device variety Experia Pro 3.7 Flyer 7 Sony Tablet
More informationCS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples Emmanuel Agu Android UI Design in XML Recall: Files Hello World Android Project XML file used to design Android UI
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 informationDependence Graph Considerering Resource for Automatic Sample Program Generation
1 2 2 2 ( ) Google Android Dependence Graph Considerering Resource for Automatic Sample Program Generation Yoshimasa Fujiura, 1 Hirotaka Ohkubo, 1 Hideto Kasuya 1 and Shinichiro Yamamoto 1 This paper propose
More informationCS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming Emmanuel Agu Editting in Android Studio Recall: Editting Android Can edit apps in: Text View: edit XML directly Design
More informationANDROID APP DEVELOPMENT
0 Version 1.2 ANDROID APP DEVELOPMENT By AbhiAndroid 0 AbhiAndroid.com 1 Awesome Thank you for downloading this guide Hi, My name is Abhishek. I m 26 year old guy from India. I m on mission and my mission
More informationCS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu Android UI Tour Home Screen First screen after unlocking phone or hitting home button Includes favorites tray
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 informationUI Fragment.
UI Fragment 1 Contents Fragments Overviews Lifecycle of Fragments Creating Fragments Fragment Manager and Transactions Adding Fragment to Activity Fragment-to-Fragment Communication Fragment SubClasses
More informationMobile User Interfaces
Mobile User Interfaces CS 2046 Mobile Application Development Fall 2010 Announcements Next class = Lab session: Upson B7 Office Hours (starting 10/25): Me: MW 1:15-2:15 PM, Upson 360 Jae (TA): F 11:00
More informationUsing Eclipse for Android Development
3 Using Eclipse for Android Development This chapter is an introduction to building a complete Android app. The chapter includes creating a new app project, exploring the components of an Android app,
More informationCS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu
CS 528 Mobile and Ubiquitous Computing Lecture 2: Intro to Android Programming Emmanuel Agu Students: Please Introduce Yourselves! Name Status: grad/undergrad, year Relevant background: e.g. coal miner
More informationMobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences
Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences Agenda Dialogs Menus SharedPreferences Android Application Components 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service
More informationListView (link) An ordered collection of selectable choices. key attributes in XML:
CS 193A Lists This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. ListView (link) An ordered collection
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 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 informationES E 3 3 L a L b 5 Android development
ES3 Lab 5 Android development This Lab Create a simple Android interface Use XML interface layouts Access the filesystem Play media files Info about Android development can be found at http://developer.android.com/index.html
More informationDeveloping Android Applications Introduction to Software Engineering Fall Updated 1st November 2015
Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 1st November 2015 Android Lab 3 & Midterm Additional Concepts No Class Assignment 2 Class Plan Android : Additional
More informationMobile and Ubiquitous Computing: Android Programming (part 4)
Mobile and Ubiquitous Computing: Android Programming (part 4) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Examples from: Mobile and Ubiquitous Computing Jo Vermeulen,
More informationSoftware Engineering Large Practical: Storage, Settings and Layouts. Stephen Gilmore School of Informatics October 27, 2017
Software Engineering Large Practical: Storage, Settings and Layouts Stephen Gilmore School of Informatics October 27, 2017 Contents 1. Storing information 2. Settings 3. Layouts 1 Storing information Storage
More informationLecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming
University of Babylon College of Information Technology Department of Information Networks Mobile Fundamentals and Programming Lecture 7: Data Persistence : shared preferences Lecturer : Ali Kadhim Al-Bermani
More information07. Data Storage
07. Data Storage 22.03.2018 1 Agenda Data storage options How to store data in key-value pairs How to store structured data in a relational database 2 Data Storage Options Shared Preferences Store private
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 informationData storage and exchange in Android
Mobile App Development 1 Overview 2 3 SQLite Overview Implementation 4 Overview Methods to implement URI like SQL 5 Internal storage External storage Overview 1 Overview 2 3 SQLite Overview Implementation
More informationActivities and Fragments
Activities and Fragments 21 November 2017 Lecture 5 21 Nov 2017 SE 435: Development in the Android Environment 1 Topics for Today Activities UI Design and handlers Fragments Source: developer.android.com
More informationUser Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University
User Interface: Layout Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University http://twitter.com/krunapon Agenda User Interface Declaring Layout Common Layouts User Interface
More informationMobile Application Programing: Android. View Persistence
Mobile Application Programing: Android Persistence Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another
More informationProgramming with Android: Android for Tablets. Dipartimento di Scienze dell Informazione Università di Bologna
Programming with Android: Android for Tablets Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Android for Tablets: A Case Study Android for Tablets:
More informationBuilding MyFirstApp Android Application Step by Step. Sang Shin Learn with Passion!
Building MyFirstApp Android Application Step by Step. Sang Shin www.javapassion.com Learn with Passion! 1 Disclaimer Portions of this presentation are modifications based on work created and shared by
More informationCE881: Mobile & Social Application Programming
CE881: Mobile & Social Application Programming Fragments and Jialin Liu Senior Research Officer Univerisity of Essex 13 Feb 2017 Today s App : Pocket (1/3) Today s App : Pocket (2/3) Today s App : Pocket
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 informationCS371m - Mobile Computing. Persistence
CS371m - Mobile Computing Persistence Storing Data Multiple options for storing data associated with apps Shared Preferences Internal Storage device memory External Storage SQLite Database Network Connection
More informationMOBILE CLIENT FOR ONLINE DICTIONARY. Constantin Lucian ALDEA 1. Abstract
Bulletin of the Transilvania University of Braşov Vol 4(53), No. 2-2011 Series III: Mathematics, Informatics, Physics, 123-128 MOBILE CLIENT FOR ONLINE DICTIONARY Constantin Lucian ALDEA 1 Abstract The
More informationChapter 2 Welcome App
2.8 Internationalizing Your App 1 Chapter 2 Welcome App 2.1 Introduction a. Android Studio s layout editor enables you to build GUIs using drag-and-drop techniques. b. You can edit the GUI s XML directly.
More informationResources and Media and Dealies
Resources and Media and Dealies In the second week, we created a new project that came with several files. The layout was kept in a res/layout folder. last week, we looked at a landscape layout, in the
More informationFig. 2.2 New Android Application dialog. 2.3 Creating an App 41
AndroidHTP_02.fm Page 41 Wednesday, April 30, 2014 3:00 PM 2.3 Creating an App 41 the Welcome app s TextView and the ImageViews accessibility strings, then shows how to test the app on an AVD configured
More informationAdaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.
Creating dialogs 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 and
More informationgetcount getitem getitemid getview com.taxi Class MainActivity drawerlayout drawerleft drawerright...
Contents com.taxi.ui Class CallDialog... 3 CallDialog... 4 show... 4 build... 5 com.taxi.custom Class CustomActivity... 5 TOUCH... 6 CustomActivity... 6 onoptionsitemselected... 6 onclick... 6 com.taxi.model
More informationANDROID USER INTERFACE
1 ANDROID USER INTERFACE Views FUNDAMENTAL UI DESIGN Visual interface element (controls or widgets) ViewGroup Contains multiple widgets. Layouts inherit the ViewGroup class Activities Screen being displayed
More informationACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi
ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the
More informationIntegrated development environment (IDE), 16 Intent explicit intents, 37 filters, 37
Index A Action bar action providers, 147 action view accessing, 146 collapsing, 146 declaration, 145 SearchView, 145 callback method, 144 components, 140 default Theme.Holo theme, 140 getactionbar method,
More informationAndroid Basics. Android UI Architecture. Android UI 1
Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à
More informationHave a development environment in 256 or 255 Be familiar with the application lifecycle
Upcoming Assignments Readings: Chapter 4 by today Horizontal Prototype due Friday, January 22 Quiz 2 today at 2:40pm Lab Quiz next Friday during lecture time (2:10-3pm) Have a development environment in
More information14.1 Overview of Android
14.1 Overview of Android - Blackberry smart phone appeared in 2003 First widely used mobile access to the Web - Smart phone market now dominated by Android, iphone, and Windows Phone - Tablets are now
More informationMobila applikationer och trådlösa nät, HI1033, HT2012
Mobila applikationer och trådlösa nät, HI1033, HT2012 Today: - User Interface basics - View components - Event driven applications and callbacks - Menu and Context Menu - ListView and Adapters - Android
More informationExternal Services. CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion
External Services CSE 5236: Mobile Application Development Course Coordinator: Dr. Rajiv Ramnath Instructor: Adam C. Champion 1 External Services Viewing websites Location- and map-based functionality
More informationCS260 Intro to Java & Android 05.Android UI(Part I)
CS260 Intro to Java & Android 05.Android UI(Part I) Winter 2015 Winter 2015 CS250 - Intro to Java & Android 1 User Interface UIs in Android are built using View and ViewGroup objects A View is the base
More informationANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)
ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted
More informationAgenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen
Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing
More informationLecture 2 Android SDK
Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a
More informationWhen programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are:
ETSN05, Fall 2017, Version 1.0 Software Development of Large Systems Lab 2 preparations Read through this document carefully. In order to pass lab 2, you will need to understand the topics presented in
More informationAndroid CardView Tutorial
Android CardView Tutorial by Kapil - Wednesday, April 13, 2016 http://www.androidtutorialpoint.com/material-design/android-cardview-tutorial/ YouTube Video We have already discussed about RecyclerView
More informationCS260 Intro to Java & Android 05.Android UI(Part I)
CS260 Intro to Java & Android 05.Android UI(Part I) Winter 2018 Winter 2018 CS250 - Intro to Java & Android 1 User Interface UIs in Android are built using View and ViewGroup objects A View is the base
More informationStanislav Rost CSAIL, MIT
Session 2: Lifecycles, GUI Stanislav Rost CSAIL, MIT The Plan 1 Activity lifecycle Service lifecycle 2 Selected GUI elements UI Layouts 3 Hands on assignment: RoboChat Application GUI Design Birth, death,
More information04. Learn the basic widget. DKU-MUST Mobile ICT Education Center
04. Learn the basic widget DKU-MUST Mobile ICT Education Center Goal Understanding of the View and Inheritance of View. Learn how to use the default widget. Learn basic programming of the Android App.
More informationCS371m - Mobile Computing. More UI Action Bar, Navigation, and Fragments
CS371m - Mobile Computing More UI Action Bar, Navigation, and Fragments ACTION BAR 2 Options Menu and Action Bar prior to Android 3.0 / API level 11 Android devices required a dedicated menu button Pressing
More informationA view is a widget that has an appearance on screen. A view derives from the base class android.view.view.
LAYOUTS Views and ViewGroups An activity contains Views and ViewGroups. A view is a widget that has an appearance on screen. A view derives from the base class android.view.view. One or more views can
More informationANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)
ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not
More informationExercise 1: First Android App
Exercise 1: First Android App Start a New Android Studio App Open Android Studio. Click on Start a new Android Studio project. For Application name enter First App. Keep other fields as default and click
More informationCS371m - Mobile Computing. User Interface Basics
CS371m - Mobile Computing User Interface Basics Clicker Question Have you ever implemented a Graphical User Interface (GUI) as part of a program? A. Yes, in another class. B. Yes, at a job or internship.
More informationCS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars
CS371m - Mobile Computing More UI Navigation, Fragments, and App / Action Bars EFFECTIVE ANDROID NAVIGATION 2 Clicker Question Have you heard of the terms Back and Up in the context of Android Navigation?
More informationAndroid Development Crash Course
Android Development Crash Course Campus Sundsvall, 2015 Stefan Forsström Department of Information and Communication Systems Mid Sweden University, Sundsvall, Sweden OVERVIEW The Android Platform Start
More information