This document describes the design of a Hangman game application for Android mobile devices. It includes use cases, UI mockups, class diagrams, and other design documents. The application allows users to play the classic Hangman game on their Android device by guessing letters to solve a mystery word. Key features include starting new games, continuing incomplete games, playing with touch, keys, or navigation buttons, getting hints, and adjusting settings like enabling music. Storyboards and screenshots demonstrate example user flows through the app. The technical documentation provides details on app architecture, components, and development strategy.
This document provides an agenda and slides for a presentation titled "Clean Coding in PL/SQL and SQL" given by Brendan Furey at the Ireland Oracle User Group on April 4-5, 2019. The presentation covers various topics related to clean coding practices in PL/SQL and SQL, including general programming design concepts, design principles, use of object types and collections, API design examples, and SQL modularity. The agenda outlines sections on programming paradigms, package and subprogram structure, object types and collections, API design with examples, integrating Oracle with other languages, Oracle's object-orientation features, and applying modular design to SQL.
Jetpack Compose is Android's new modern toolkit for building native UI using less code and powerful Kotlin APIs. It is inspired by React, Litho, Vue.js and Flutter but written completely in Kotlin. Compose aims to simplify and reduce code by separating concerns through a declarative paradigm instead of the traditional imperative view approach. It uses a gap buffer data structure to efficiently manage changes to UI over time in a reactive way. While still in developer preview, Compose shows promise for improving the Android UI development experience.
This is an InHouse project report on the Android Application I made on Fitness MAnagement, This Application Tracks BMI, BMR, Calorie intake and also tracks the calories in different food items.
Food item names can be selected from a list and can be tracked on a daily basis.
This document is a project report for the "Learn & Fun" educational software system. It includes acknowledgments, an introduction describing the purpose of the document, and an executive summary providing an overview of the software development lifecycle phases covered. The document contains requirements analysis diagrams, descriptions of the implemented functions and user interface, and a testing plan. The goal of the "Learn & Fun" system is to improve the current educational system for children by allowing them to learn through an interactive digital platform.
This presentation discusses the development of a simple calculator app (CalcV1) using Google Cloud Engines. It introduces the team, date, and aim of understanding Google AppEngine. The presentation covers the technologies used - AngularJS, Java, HTML5 and CSS3, the system design, the 2MOC method for calculations, a software showcase, and a conclusion that the team gained practical experience using Google Cloud Engines.
Java applets are small Java programs that can be embedded within HTML pages. When a user views a page containing an applet, the applet code is transferred to their system and executed by the Java Virtual Machine within their browser. Applets allow for interactive features on web pages like capturing mouse input and including buttons or checkboxes. They can also play media formats not natively supported by browsers. Applets are embedded using the applet or object tags, which can specify the applet's location and download any necessary Java plugins.
This document provides an agenda and slides for a presentation titled "Clean Coding in PL/SQL and SQL" given by Brendan Furey at the Ireland Oracle User Group on April 4-5, 2019. The presentation covers various topics related to clean coding practices in PL/SQL and SQL, including general programming design concepts, design principles, use of object types and collections, API design examples, and SQL modularity. The agenda outlines sections on programming paradigms, package and subprogram structure, object types and collections, API design with examples, integrating Oracle with other languages, Oracle's object-orientation features, and applying modular design to SQL.
Jetpack Compose is Android's new modern toolkit for building native UI using less code and powerful Kotlin APIs. It is inspired by React, Litho, Vue.js and Flutter but written completely in Kotlin. Compose aims to simplify and reduce code by separating concerns through a declarative paradigm instead of the traditional imperative view approach. It uses a gap buffer data structure to efficiently manage changes to UI over time in a reactive way. While still in developer preview, Compose shows promise for improving the Android UI development experience.
This is an InHouse project report on the Android Application I made on Fitness MAnagement, This Application Tracks BMI, BMR, Calorie intake and also tracks the calories in different food items.
Food item names can be selected from a list and can be tracked on a daily basis.
This document is a project report for the "Learn & Fun" educational software system. It includes acknowledgments, an introduction describing the purpose of the document, and an executive summary providing an overview of the software development lifecycle phases covered. The document contains requirements analysis diagrams, descriptions of the implemented functions and user interface, and a testing plan. The goal of the "Learn & Fun" system is to improve the current educational system for children by allowing them to learn through an interactive digital platform.
This presentation discusses the development of a simple calculator app (CalcV1) using Google Cloud Engines. It introduces the team, date, and aim of understanding Google AppEngine. The presentation covers the technologies used - AngularJS, Java, HTML5 and CSS3, the system design, the 2MOC method for calculations, a software showcase, and a conclusion that the team gained practical experience using Google Cloud Engines.
Java applets are small Java programs that can be embedded within HTML pages. When a user views a page containing an applet, the applet code is transferred to their system and executed by the Java Virtual Machine within their browser. Applets allow for interactive features on web pages like capturing mouse input and including buttons or checkboxes. They can also play media formats not natively supported by browsers. Applets are embedded using the applet or object tags, which can specify the applet's location and download any necessary Java plugins.
DOM and SAX are two APIs for working with XML documents. DOM loads the entire XML document into memory as a tree structure, allowing manipulation of the document. SAX is event-based and reads the XML document sequentially, invoking callback functions at element boundaries. Compared to DOM, SAX uses less memory but only allows reading of the document. Both APIs are supported across many programming languages including PHP.
JavaScript for ABAP Programmers - 1/7 IntroductionChris Whealy
JavaScript was originally created as Mocha in 1995 by Brendan Eich at Netscape in 10 days and was renamed LiveScript and then JavaScript to complement Sun Microsystem's Java, though it is not the same as Java. It borrows elements from languages like Scheme and Perl. JavaScript is standardized by ECMA and various JavaScript engines like SpiderMonkey, Chakra, V8, and Nitro execute it client-side in browsers or server-side in implementations like HANA XSJS. The main differences between JavaScript and ABAP are that JavaScript is weakly typed, has lexical scope, treats functions as first-class citizens, uses prototypal inheritance, and allows both imperative and functional programming.
This document provides information about applet programming in Java. It discusses that applets are small Java programs used primarily for internet computing. Applets can perform tasks like displaying graphics, playing sounds, and accepting user input. Key differences between applets and standalone applications include applets not having a main method, needing to be embedded in an HTML page, and having restrictions on file/network access. The document also covers the applet lifecycle, writing applet code, and using HTML tags to embed applets in web pages.
This document discusses working with color and font in Java. It covers the Color and Font classes, including their constructors and commonly used methods. Color can be specified using RGB values or floats between 0-1. Fonts are created using the Font constructor specifying name, style, and size. The setColor() and setFont() methods on Graphics and Component respectively are used to select the drawing color and font. Examples are provided to demonstrate color and font usage.
This document provides an overview of Java Server Pages (JSP) technology. Some key points:
- JSP allows separation of work between web designers and developers by allowing HTML/CSS design and Java code to be placed in the same file.
- A JSP page is compiled into a servlet, so it can take advantage of servlet features like platform independence and database-driven applications.
- JSP pages use tags like <jsp:include> and <jsp:useBean> to include content and access JavaBeans. Scriptlets, expressions, declarations, and directives are also used.
- Implicit objects like request, response, out, and session are automatically available in JSP pages
C was developed in 1972 by Dennis Ritchie at Bell Labs. It was created to deal with limitations of earlier languages like B and BCPL. C is a general purpose, procedural programming language that is highly portable and can be compiled on various computer platforms. It is well-suited for system programming like operating systems and embedded systems. C provides features for structured programming, memory management, pointers, and interfacing with hardware. It remains widely used in software development today.
Flutter is an open-source UI toolkit created by Google that allows developers to build mobile, web, and desktop applications from a single codebase. It uses Dart as its programming language and employs a hybrid approach combining both native and web development techniques. In Flutter, everything that appears on the screen is represented as a Widget, whether visible or invisible, and widgets can be either stateless or stateful depending on whether their appearance changes over time in response to events.
Java is an object-oriented programming language introduced in 1995. It is platform independent and used widely for web applications. Java code is compiled into bytecode that runs on a virtual machine, allowing the same code to run on different operating systems. Key features of Java include being simple, object-oriented, platform independent, robust, secure, distributed, multithreaded, and dynamic.
The JDK contains the JRE plus development tools like the javac compiler and java runtime. The JRE contains libraries and files used by the JVM at runtime. The JVM provides the runtime environment to execute bytecode and allows Java to be platform independent, though the JVM itself is operating system dependent.
Mindmap: Oracle to Couchbase for developersKeshav Murthy
This deck provides a high-level comparison between Oracle and Couchbase: Architecture, database objects, types, data model, SQL & N1QL statements, indexing, optimizer, transactions, SDK and deployment options.
A flappy bird step by step guide to new or interested game developers at the introductory week of the 2017 global game jam lagos using the Unity engine
Introduction to Java Programming Languagejaimefrozr
The document provides an introduction and history of the Java programming language. It discusses that Java was originally developed in 1991 by Sun Microsystems to be portable for consumer electronic devices. The document then summarizes the key capabilities of Java including being a general purpose language that can develop robust applications for desktops, servers, and mobile devices. It also outlines the Java language specifications, application programming interface containing predefined classes, and development tools available. Finally, it explains how Java's use of byte code and the Java Virtual Machine allows it to be highly portable across different operating systems.
Flutter is an open-source SDK developed by Google that allows building high-performance mobile apps for both Android and iOS from a single codebase. It uses its own rendering engine instead of webviews or native widgets, and has a thin C/C++ layer with most code implemented in Dart. Flutter supports hot reload which allows code changes to take effect instantly without losing app state. It is optimized for building 2D apps and supports features like camera, geolocation, and third-party SDKs.
in these slides i have explained the factory method design pattern. slides contains complete notes on this pattern from definition to implementation by code example.
The document discusses compilers, defining them as programs that translate human-oriented programming languages into machine languages. It describes the main phases of a compiler as lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation. Finally, it outlines different types of compilers, including native code compilers, cross compilers, source-to-source compilers, one-pass compilers, threaded code compilers, incremental compilers, and source compilers.
The document discusses features of the Visual Studio Code text editor. It focuses on VS Code's capabilities for web development, including support for JavaScript, TypeScript, Node.js, Angular, and other frameworks through extensions. Tips are provided for navigation, debugging, formatting code, and managing development workflows through features like terminals and settings sync.
This document presents on a PHP and MySQL based website project called "Smart City Ajmer". The project aims to provide information to users about India's smart city mission and plans for Ajmer. It discusses technologies used like PHP, MySQL, HTML, CSS, and Bootstrap. It provides screenshots of the home page, feedback form, joining form, and exploring city sections. The document summarizes the purpose, features and technologies used in developing this website to inform citizens about Ajmer's smart city initiatives.
C# is an object-oriented programming language developed by Microsoft that aims to combine the computing power of C++ with the ease of use of Visual Basic. It is based on C++ but also contains features similar to Java. C# can be used to develop both executable application programs and reusable component libraries. It includes features like versioning support, events, type safety, garbage collection, and unsafe memory manipulation capabilities.
The document discusses React Native and GraphQL. It introduces React Native as a way to build native mobile apps using React and JavaScript. GraphQL is presented as an alternative to REST and OData for mobile backends by allowing clients to specify the data structure needed and supporting relationships between data. The document demonstrates GraphQL queries using an online IDE and AWS AppSync as an option for building GraphQL backends with features like subscriptions and offline support.
This document summarizes a seminar presentation on mobile games given by Nelson Zagalo at Linnaeus University in Sweden in 2012. It discusses the history and evolution of mobile games from early games on Nokia phones to current games on smartphones and tablets. It covers key topics like platforms and operating systems, programming technologies, usability considerations from touchscreens, principles of game design for mobile, and the growing mobile games economy.
DOM and SAX are two APIs for working with XML documents. DOM loads the entire XML document into memory as a tree structure, allowing manipulation of the document. SAX is event-based and reads the XML document sequentially, invoking callback functions at element boundaries. Compared to DOM, SAX uses less memory but only allows reading of the document. Both APIs are supported across many programming languages including PHP.
JavaScript for ABAP Programmers - 1/7 IntroductionChris Whealy
JavaScript was originally created as Mocha in 1995 by Brendan Eich at Netscape in 10 days and was renamed LiveScript and then JavaScript to complement Sun Microsystem's Java, though it is not the same as Java. It borrows elements from languages like Scheme and Perl. JavaScript is standardized by ECMA and various JavaScript engines like SpiderMonkey, Chakra, V8, and Nitro execute it client-side in browsers or server-side in implementations like HANA XSJS. The main differences between JavaScript and ABAP are that JavaScript is weakly typed, has lexical scope, treats functions as first-class citizens, uses prototypal inheritance, and allows both imperative and functional programming.
This document provides information about applet programming in Java. It discusses that applets are small Java programs used primarily for internet computing. Applets can perform tasks like displaying graphics, playing sounds, and accepting user input. Key differences between applets and standalone applications include applets not having a main method, needing to be embedded in an HTML page, and having restrictions on file/network access. The document also covers the applet lifecycle, writing applet code, and using HTML tags to embed applets in web pages.
This document discusses working with color and font in Java. It covers the Color and Font classes, including their constructors and commonly used methods. Color can be specified using RGB values or floats between 0-1. Fonts are created using the Font constructor specifying name, style, and size. The setColor() and setFont() methods on Graphics and Component respectively are used to select the drawing color and font. Examples are provided to demonstrate color and font usage.
This document provides an overview of Java Server Pages (JSP) technology. Some key points:
- JSP allows separation of work between web designers and developers by allowing HTML/CSS design and Java code to be placed in the same file.
- A JSP page is compiled into a servlet, so it can take advantage of servlet features like platform independence and database-driven applications.
- JSP pages use tags like <jsp:include> and <jsp:useBean> to include content and access JavaBeans. Scriptlets, expressions, declarations, and directives are also used.
- Implicit objects like request, response, out, and session are automatically available in JSP pages
C was developed in 1972 by Dennis Ritchie at Bell Labs. It was created to deal with limitations of earlier languages like B and BCPL. C is a general purpose, procedural programming language that is highly portable and can be compiled on various computer platforms. It is well-suited for system programming like operating systems and embedded systems. C provides features for structured programming, memory management, pointers, and interfacing with hardware. It remains widely used in software development today.
Flutter is an open-source UI toolkit created by Google that allows developers to build mobile, web, and desktop applications from a single codebase. It uses Dart as its programming language and employs a hybrid approach combining both native and web development techniques. In Flutter, everything that appears on the screen is represented as a Widget, whether visible or invisible, and widgets can be either stateless or stateful depending on whether their appearance changes over time in response to events.
Java is an object-oriented programming language introduced in 1995. It is platform independent and used widely for web applications. Java code is compiled into bytecode that runs on a virtual machine, allowing the same code to run on different operating systems. Key features of Java include being simple, object-oriented, platform independent, robust, secure, distributed, multithreaded, and dynamic.
The JDK contains the JRE plus development tools like the javac compiler and java runtime. The JRE contains libraries and files used by the JVM at runtime. The JVM provides the runtime environment to execute bytecode and allows Java to be platform independent, though the JVM itself is operating system dependent.
Mindmap: Oracle to Couchbase for developersKeshav Murthy
This deck provides a high-level comparison between Oracle and Couchbase: Architecture, database objects, types, data model, SQL & N1QL statements, indexing, optimizer, transactions, SDK and deployment options.
A flappy bird step by step guide to new or interested game developers at the introductory week of the 2017 global game jam lagos using the Unity engine
Introduction to Java Programming Languagejaimefrozr
The document provides an introduction and history of the Java programming language. It discusses that Java was originally developed in 1991 by Sun Microsystems to be portable for consumer electronic devices. The document then summarizes the key capabilities of Java including being a general purpose language that can develop robust applications for desktops, servers, and mobile devices. It also outlines the Java language specifications, application programming interface containing predefined classes, and development tools available. Finally, it explains how Java's use of byte code and the Java Virtual Machine allows it to be highly portable across different operating systems.
Flutter is an open-source SDK developed by Google that allows building high-performance mobile apps for both Android and iOS from a single codebase. It uses its own rendering engine instead of webviews or native widgets, and has a thin C/C++ layer with most code implemented in Dart. Flutter supports hot reload which allows code changes to take effect instantly without losing app state. It is optimized for building 2D apps and supports features like camera, geolocation, and third-party SDKs.
in these slides i have explained the factory method design pattern. slides contains complete notes on this pattern from definition to implementation by code example.
The document discusses compilers, defining them as programs that translate human-oriented programming languages into machine languages. It describes the main phases of a compiler as lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation. Finally, it outlines different types of compilers, including native code compilers, cross compilers, source-to-source compilers, one-pass compilers, threaded code compilers, incremental compilers, and source compilers.
The document discusses features of the Visual Studio Code text editor. It focuses on VS Code's capabilities for web development, including support for JavaScript, TypeScript, Node.js, Angular, and other frameworks through extensions. Tips are provided for navigation, debugging, formatting code, and managing development workflows through features like terminals and settings sync.
This document presents on a PHP and MySQL based website project called "Smart City Ajmer". The project aims to provide information to users about India's smart city mission and plans for Ajmer. It discusses technologies used like PHP, MySQL, HTML, CSS, and Bootstrap. It provides screenshots of the home page, feedback form, joining form, and exploring city sections. The document summarizes the purpose, features and technologies used in developing this website to inform citizens about Ajmer's smart city initiatives.
C# is an object-oriented programming language developed by Microsoft that aims to combine the computing power of C++ with the ease of use of Visual Basic. It is based on C++ but also contains features similar to Java. C# can be used to develop both executable application programs and reusable component libraries. It includes features like versioning support, events, type safety, garbage collection, and unsafe memory manipulation capabilities.
The document discusses React Native and GraphQL. It introduces React Native as a way to build native mobile apps using React and JavaScript. GraphQL is presented as an alternative to REST and OData for mobile backends by allowing clients to specify the data structure needed and supporting relationships between data. The document demonstrates GraphQL queries using an online IDE and AWS AppSync as an option for building GraphQL backends with features like subscriptions and offline support.
This document summarizes a seminar presentation on mobile games given by Nelson Zagalo at Linnaeus University in Sweden in 2012. It discusses the history and evolution of mobile games from early games on Nokia phones to current games on smartphones and tablets. It covers key topics like platforms and operating systems, programming technologies, usability considerations from touchscreens, principles of game design for mobile, and the growing mobile games economy.
02 - Game Development: Best Practice (Febri 'Ebinkatsu' Abdullah)Lab Mobile Filkom UB
This document discusses game development and an indie game developer team. It introduces the team called Simpleton who was founded in late 2013 and has developed 5 Android and Windows Phone games and 1 Windows PC game currently in development. It discusses the pros and cons of being an indie developer including creative freedom but also financial risk. It provides trailers for some of the team's games and discusses their participation and achievements in past developer challenges and contests. It provides tips for game developers to start small, finish projects, outdo themselves with each new game, learn from mistakes, and focus on quality over quantity.
This document discusses creating a multiplayer 3D racing game using Unity. It describes using Unity's assets to build the game environment and circuits. It provides instructions on modeling a 3D car asset, adding physics components, and scripting to enable controls and multiplayer functionality. The document also covers adding collision, shadows, and skid marks to enhance the car and racing experience. It concludes by explaining how to package the car as a prefab that can be reused across Unity projects.
THE ANIMALS merupakan game buatan anak bangsa dengan nama organisasi yaitu “Antariksa Team” Game ini merupakan game yang bergenre Game Edukasi yang mayoritas penggunanya adalah anak anak sampai dengan remaja. Game ini sangat menarik bagi penggunanya sehingga pengguna setelah memainkan game THE ANIMALS dapat merasakan manfaatnya.
(Game Project UAS MULTIMEDIA)
HAK CIPTA@2015
1. Angkasa Putra
2. Alfian Dhinofahma
3. Dani Gusmana
Dokumen tersebut membahas konsep dasar pemrograman berorientasi objek (OOP) seperti pembungkusan, tingkat akses, pewarisan, dan polimorfisme. Dokumen tersebut juga menjelaskan anggota kelas seperti metode, properti, event, indexer, operator, konstruktor, dan destruktor. Terakhir, dokumen tersebut menampilkan contoh program sederhana menggunakan konsep-konsep OOP.
Purwarupa Komik Interaktif Safety Riding Berkonsep Digital StorytellingToto Haryadi
Ringkasan dokumen tersebut adalah sebagai berikut:
1. Dokumen tersebut membahas perancangan purwarupa komik interaktif untuk kampanye safety riding menggunakan pendekatan digital storytelling.
2. Data diperoleh melalui wawancara, observasi, dan studi literatur untuk mengembangkan konten purwarupa komik interaktif tentang safety riding.
3. Purwarupa komik interaktif diharapkan dapat dikembangkan lebih lanjut sebagai media pendukung
Dokumen tersebut membahas beberapa metode pengembangan game yaitu metode iterasi, SDLC, MDLC, dan metode mandiri. Metode iterasi melibatkan proses merancang, menguji, dan mengevaluasi secara berulang untuk meningkatkan gameplay dan pengalaman pemain. SDLC dan MDLC lebih menekankan pada tahapan-tahapan pengembangan sistem/multimedia. Developer juga dianjurkan untuk mengembangkan metode sendiri sesuai kebutuhan proyek.
This document provides an installation and user manual for HyperGateway's HG-3000 & HG-2000 & HG-1600 Series products. The manual includes sections on system architecture, installation, configuration using the Hypermedia Management Console (HMC) software, settings for cellular and PRI cards, system monitoring and troubleshooting. The HyperGateway system allows integration of cellular networks like GSM and CDMA with PRI networks to take voice communications to the next level.
This document provides instructions for installing and administering R, the open-source statistical software and programming language. It covers obtaining R sources, installing on Unix-like and Windows systems, installing add-on packages, internationalization, and other topics. Permission is granted to distribute verbatim or modified copies of the manual under certain conditions.
This document is a manual for Cinelerra CV, an open source non-linear video editor for Linux. It discusses installing and configuring Cinelerra CV, including hardware and software requirements and instructions for different Linux distributions. It also covers compiling Cinelerra from source, configuring audio and video drivers, and playback settings. The manual is distributed under the GNU GPL license.
This document provides an overview of the PDF CMD SDK which allows developers to:
1. Convert documents to PDF format and control conversion settings such as security, compression, and font embedding through interfaces like IPDFCreate.
2. Combine multiple PDF documents into a single file using the IPDFCombineInterface.
3. Package files into a password protected PDF portfolio using the IPDFPackageInterface.
4. Edit existing PDF files by opening, creating new files, and saving through the IPDFFileEdit interface.
The SDK allows developers to programmatically generate, secure, combine and edit PDF files through its various interfaces.
This document provides an overview of the hardware components and features of a notebook PC. It describes the keys, touchpad, buttons, lights and ports located on the exterior of the computer. It also discusses the optical drive, hard drive, memory modules, wireless capabilities and battery that are contained inside the notebook. The document is intended to help users identify the parts of their computer and understand their basic functions.
This document provides instructions for installing and administering R on various operating systems. It covers obtaining R sources, installing on Unix-like systems, Windows, and OS X. It also discusses installing add-on packages, internationalization, choosing 32- vs 64-bit builds, and using the standalone Rmath library. The document is intended as a manual for installing and managing R versions 3.0.2 or higher.
This document provides an overview and reference for Hibernate, an object-relational mapping tool for Java. It discusses Hibernate's architecture and basic APIs for mapping objects to relational databases. The document also covers configuring Hibernate, implementing persistent classes, basic object-relational mappings, and integrating Hibernate with Java application servers.
This document is the user manual for Oracle VM VirtualBox version 4.1.2. It provides instructions on installing VirtualBox on various host operating systems like Windows, Mac OS X, Linux and Solaris. It also describes how to configure, install guest additions, and manage various aspects of virtual machines like storage, networking and more.
The document is a user guide for the ZTE Avid 828 phone. It includes sections for getting started with the phone, personalizing settings, making calls, connecting to networks and devices, and more. The guide provides instructions and pictures to help users start using their new phone's basic and advanced features.
This document is the user guide for the Seagate FreeAgent Theater+ HD Media Player. It provides instructions on how to set up, connect, and use the media player to watch movies, view photos, listen to music, and access online streaming services from local or networked storage drives. The guide covers powering on the device, navigating menus, playing different media types, customizing settings, troubleshooting issues, and more.
This document is the user guide for the Seagate FreeAgent Theater+ HD Media Player. It provides instructions on how to set up, connect, and use the media player to watch movies, view photos, listen to music, and access online streaming services from local or networked storage drives. The guide covers powering on the device, navigating menus, playing different media types, customizing settings, troubleshooting issues, and more.
This document provides notes from a Linux system administration course. It covers topics like installing Red Hat Linux, configuring XFree86 for graphics, managing software packages, understanding the boot sequence, basic network concepts, kernel functions, configuring services, managing users and groups, working with filesystems, and basic security measures. The document contains detailed sections on partitioning and formatting disks, mounting filesystems, and using common Linux administration tools.
This document provides an introduction to the IBM GDPS family of offerings. It discusses business resilience requirements and how GDPS supports IT resilience through technologies like disk replication and automation. The document covers GDPS/PPRC, which uses IBM's Peer-to-Peer Remote Copy (PPRC) technology for continuous availability and disaster recovery. It also addresses infrastructure planning considerations for GDPS implementations.
This document provides guidance on configuring the X Windows system on HP-UX systems with various graphics cards, including HP Visualize cards. It describes the X configuration files used, such as X*screens and XF86Config, and covers topics like configuring displays, monitors, input devices and extensions. The document also provides sample configuration files and device-specific information.
This document provides instructions for installing and administering R on various operating systems. It covers obtaining R sources, compiling and installing R under Unix-like systems, Windows, and Mac OS X. It also discusses running R, installing add-on packages, internationalization, choosing 32- vs 64-bit builds, and the standalone Rmath library.
This document is a user's manual that provides instructions and specifications for Toshiba Satellite laptop models L700, L740, L745, L700D, L740D and L745D. It includes sections on getting started, an overview of hardware features and components, operating instructions, keyboard functions, power management settings, hardware setup options, and troubleshooting. The manual provides guidance on set up, use and maintenance of the laptops to help users get the most from their Toshiba device.
Samsung is World’s second largest Mobile manufacturing company launching various groundbreaking and attractive mobiles in all range of price from low to high. Samsung R680 Repp has 3.2-inch TFT touchscreen display with 320 X 480 pixels resolution. It has 3.15 MP camera with digital zoom, FM Radio with recorder, multi format music player with 3.5mm audio jack, and social networking integration.
This document is the user manual for HDClone, a software program for copying, backing up, migrating, and rescuing hard disks. It provides instructions on installing HDClone, supported hardware, and using the program. Key features covered include copying disks while the system is running, creating disk images, and duplicating master system installations.
This document provides instructions for installing and configuring OpenStack. It describes the OpenStack architecture and services, how to set up the necessary infrastructure components like networking, databases and message queues, and how to deploy the core OpenStack services. It also provides steps for launching a test instance and interacting with basic OpenStack features like networks, block storage and orchestration.
SERV is the ideal spot for savory food, refreshing beverages, and exciting entertainment. Each visit promises an unforgettable experience with daily promotions, live music, and engaging games such as pickleball. Offering five distinct food concepts inspired by popular street food, as well as coffee and dessert options, there's something to satisfy every taste. For more information visit our website: https://servfun.com/
Explore Treydora's VR economy, where users can trade virtual assets, earn rewards, and build digital wealth within immersive game environments. Learn more!
Audio Video equipment supplier in Gurgaondemoacsindia
Explore our website for the latest audio visual equipment. From projectors to
speakers, we have everything you need to elevate your audio and visual setup.
Leading audio visual equipment supplier in Gurgaon offering a wide range of
high-quality products for all your audio and visual needs.
HD Video Player All Format - 4k & live streamHD Video Player
Discover the best video playback experience with HD Video Player. Our powerful, user-friendly app supports all popular video formats and codecs, ensuring seamless playback of your favorite videos in stunning HD and 4K quality. Whether you're watching movies, TV shows, or personal videos, HD Video Player provides the ultimate viewing experience on your device. 🚀
The cats, Sunny and Rishi, are brothers who live with their sister, Jessica, and their grandmother, Susie. They work as cleaners but wish to seek other kinds of employment that are better than their current jobs. New career adventures await Sunny and Rishi!
Morgan Freeman is Jimi Hendrix: Unveiling the Intriguing Hypothesisgreendigital
In celebrity mysteries and urban legends. Few narratives capture the imagination as the hypothesis that Morgan Freeman is Jimi Hendrix. This fascinating theory posits that the iconic actor and the legendary guitarist are, in fact, the same person. While this might seem like a far-fetched notion at first glance. a deeper exploration reveals a rich tapestry of coincidences, speculative connections. and a surprising alignment of life events fueling this captivating hypothesis.
Follow us on: Pinterest
Introduction to the Hypothesis: Morgan Freeman is Jimi Hendrix
The idea that Morgan Freeman is Jimi Hendrix stems from a mix of historical anomalies, physical resemblances. and a penchant for myth-making that surrounds celebrities. While Jimi Hendrix's official death in 1970 is well-documented. some theorists suggest that Hendrix did not die but instead reinvented himself as Morgan Freeman. a man who would become one of Hollywood's most revered actors. This article aims to delve into the various aspects of this hypothesis. examining its origins, the supporting arguments. and the cultural impact of such a theory.
The Genesis of the Theory
Early Life Parallels
The hypothesis that Morgan Freeman is Jimi Hendrix begins by comparing their early lives. Jimi Hendrix, born Johnny Allen Hendrix in Seattle, Washington, on November 27, 1942. and Morgan Freeman, born on June 1, 1937, in Memphis, Tennessee, have lived very different lives. But, proponents of the theory suggest that the five-year age difference is negligible and point to Freeman's late start in his acting career as evidence of a life lived before under a different identity.
The Disappearance and Reappearance
Jimi Hendrix's death in 1970 at the age of 27 is a well-documented event. But, theorists argue that Hendrix's death staged. and he reemerged as Morgan Freeman. They highlight Freeman's rise to prominence in the early 1970s. coinciding with Hendrix's supposed death. Freeman's first significant acting role came in 1971 on the children's television show "The Electric Company," a mere year after Hendrix's passing.
Physical Resemblances
Facial Structure and Features
One of the most compelling arguments for the hypothesis that Morgan Freeman is Jimi Hendrix lies in the physical resemblance between the two men. Analyzing photographs, proponents point out similarities in facial structure. particularly the cheekbones and jawline. Both men have a distinctive gap between their front teeth. which is rare and often highlighted as a critical point of similarity.
Voice and Mannerisms
Supporters of the theory also draw attention to the similarities in their voices. Jimi Hendrix known for his smooth, distinctive speaking voice. which, according to some, resembles Morgan Freeman's iconic, deep, and soothing voice. Additionally, both men share certain mannerisms. such as their calm demeanor and eloquent speech patterns.
Artistic Parallels
Musical and Acting Talents
Jimi Hendrix was regarded as one of t
You know you're an adult when every check-up gets you down. View What Going to the Doctor is Like as an Adult and more funny posts on salty vixen stories & more-saltyvixenstories.com
Taylor Swift: Conquering Fame, Feuds, and Unmatched Success | CIO Women MagazineCIOWomenMagazine
From country star to global phenomenon, delve into Taylor Swift's incredible journey. Explore chart-topping hits, feuds, & her rise to billionaire status!
So far, no details are known about Darby Galen’s career. She is not old enough to work yet. Currently, Darby focuses on her academic studies rather than making plans for his future career.
As a result, no one knows how much money it is worth. However, Patrick Dempsey’s net worth is projected to be around $80 million as of February 2023, as of this date.
The fact that Darby Galen Dempsey is related to Patrick Dempsey is what makes her best known. Darby was also born in Los Angeles, California on February 1, 2007. In 2020, Darby will turn 13 years old. She is Aquarius by birth sign. Her twin brother Sullivan Dempsey is also an actor.
Similarly, Darby Galen Dempsey is listed as the most famous celebrity on Wiki Famous People. Jillian Fink, Patrick Dempsey’s second wife, is Darby’s mother. Patrick Dempsey’s first wife was Rochelle “Rocky” Parker. Rocky, Patrick’s first wife, is an actress and acting teacher; However, the two divorced in 1994.
Darby’s parents, Patrick and Jillian, married in 1994. Together, Patrick and Jillian Fink are the parents of three children. Tallulah Fyfe and Sullivan Patrick, twins, are Darby’s siblings. Patrick founded the Patrick Dempsey Center, a cancer center at Central Maine Medical Center, in addition to his acting career. When Patrick’s mother was diagnosed with ovarian cancer and experienced severe suffering as a result, Patrick was motivated to find the center.
Darby Galen’s father is a well-known American actor who also drives racing cars. In Pastor’s film “McDreamy,” he plays Derek, a neurologist. The character of Darby’s father in the romantic thriller Grey’s Anatomy is well known. 2005 marked the year Darby’s father made his theatrical debut. In addition, the program is still on the air. In the 1980s, Darby’s father Patrick was the most sought-after and successful performer, and every director and producer wanted to collaborate with him. He has appeared in numerous films and television shows.
Darby’s father, Patrick, appeared in several major films during this time, such as “Can’t Buy Me Love” in 1987 and “Loverboy” in 1989. The wildly popular mystery horror film Scream 3 featured Darby’s father, Mark Kincaid, in 2000. The father is also a racing enthusiast. Darby’s father is a car fanatic who likes to race, drive sports vehicles, and collect old cars.
Party Photo Booth Prop Trends to Unleash Your Inner StyleBirthday Galore
Are you planning an unforgettable event and looking for the best photo booth props to make it a memorable night? Party photo booth props have become essential to any celebration, allowing guests to capture priceless memories and express their personalities. Here, we'll explore the hottest party photo booth prop trends that will unleash your inner style and create a buzz-worthy experience with Birthday Galore!
For more details visit - birthdaygalore.com
1. F. 1. Victor Gallego
Florida Atlantic University
Hangman
Designed for the Android Mobile Platform
Victor Gallego
December 13, 2009
2. Table of Contents
1. Introduction 4
2. Glossary 4
3. High Level Use Cases 5
A. Use Case 1- the user starts a new game ................................................................... 5
B. Use Case 2- the user continues an existing game .................................................... 5
C. Use Case 3- the user plays the game using touch screen ......................................... 6
D. Use Case 4- the user plays the game using the device keypad ................................ 6
E. Use Case 5- the user plays the game using the navigation keys .............................. 6
F. Use Case 6- the user tries again after losing a game................................................ 7
G. Use Case 7- the user tries again after winning a game ............................................ 7
H. Use Case 8- the user enables hints and music in the settings .................................. 7
I. Use Case 9- the user uses a hint during the game.................................................... 8
4. Tasks and Priorities 8
5. UI Mock-Ups and Storyboards 9
A. Main Menu Screen................................................................................................... 9
B. New Game Dialog.................................................................................................. 10
C. About Dialog.......................................................................................................... 11
D. Game Screen .......................................................................................................... 12
E. Settings Item in Menu............................................................................................ 13
F. Settings................................................................................................................... 13
G. Game Screen (Landscape Mode) ........................................................................... 14
H. Hint button ............................................................................................................. 15
I. Keypad Dialog ....................................................................................................... 16
J. Game Over dialog .................................................................................................. 17
K. Hint Used message................................................................................................. 18
L. Story Board 1: Launch Android Hangman and view About information............. 19
M. Story Board 2: Start a New Hangman Game .................................................... 20
N. Story Board 3: Guess a letter correctly ................................................................. 21
O. Story Board 4: Guess a letter incorrectly.............................................................. 22
P. Story Board 5: Enable hints in the Settings .......................................................... 23
6. High level UML 24
A. Class Diagram........................................................................................................ 24
B. Sequence Diagrams................................................................................................ 25
a. Show keypad dialog sequence........................................................................................ 25
b. Start new game sequence ............................................................................................... 26
c. Validate guess sequence................................................................................................. 27
C. Use Case Diagrams ................................................................................................ 28
a. Main Menu use case....................................................................................................... 28
b. Game use case ................................................................................................................ 28
7. Basic System Components 29
A. Hardware Components........................................................................................... 29
B. Software Components............................................................................................ 29
3. 8. Application Architecture 30
A. Activities ................................................................................................................ 30
a. Hangman Activity .......................................................................................................... 30
b. Game Activity ................................................................................................................ 30
B. Views ..................................................................................................................... 30
a. View hierarchy ............................................................................................................... 31
9. Basic Development Strategy 31
10. Appendix 32
A. Game Screen Shots ................................................................................................ 32
a. Hangman Main Screen ................................................................................................... 32
b. New Game Dialog.......................................................................................................... 33
c. Hangman Game screen................................................................................................... 33
d. Keypad Dialog................................................................................................................ 34
e. Win Dialog ..................................................................................................................... 34
f. Lose Dialog .................................................................................................................... 35
g. Hint used ........................................................................................................................ 35
h. About Dialog .................................................................................................................. 36
i. Menu button pressed ...................................................................................................... 36
j. Settings ........................................................................................................................... 37
B. Source Code ........................................................................................................... 37
a. Hangman.java................................................................................................................. 37
b. Game.java....................................................................................................................... 40
c. About.java ...................................................................................................................... 56
d. Settings.java ................................................................................................................... 56
e. Music.java ...................................................................................................................... 57
f. main.xml......................................................................................................................... 58
g. game.xml ........................................................................................................................ 58
h. about.xml........................................................................................................................ 60
i. keypad_dialog.xml ......................................................................................................... 60
j. endgame_dialog.xml ...................................................................................................... 61
k. game.xml (Landscape) ................................................................................................... 61
l. main.xml (Landscape).................................................................................................... 63
m. settings.xml................................................................................................................. 64
n. menu.xml........................................................................................................................ 64
o. AndroidManifest.xml ..................................................................................................... 64
p. strings.xml ...................................................................................................................... 65
q. arrays.xml....................................................................................................................... 65
4. Introduction
A game of hangman works as follows:
1. The program selects a word from a pool of words and displays a number of underscores
equal to the word length.
2. The user/player begins guessing letters. If the player guesses a letter that is in the word,
then all instances of that letter are displayed at their corresponding positions in the word.
Otherwise, the guess is incorrect. Every incorrect guess results in a body part being
drawn. At the first incorrect guess a head is drawn, then the body, then one arm, then the
other arm, then one leg and lastly the other leg.
3. The game ends when either all the letters in the word have been guessed or when the
player has used 6 incorrect guesses (all body parts have been drawn).
Glossary
Term Description
Player A user who plays the game of Hangman with
intention to win.
Category The superset in which a word belongs to. For
example the word “moth” belongs to the
category of “Insect”.
Mystery Word This is the word in which the player is trying to
guess during the Hangman game. Once the
player has guessed the word, the player wins.
Hint This allows the player to advance further in the
game if they are stuck. Hints become less and
less useful as more characters in the word is
guessed.
Settings Allow the user to enable and disable
preferences such as music and hints during
game.
Touch screen A capacitive display which reacts to user input
with a finger or skin contact, but not
responsive to say a fingernail.
Keypad There are two types of keypads, one on the
device and one on the screen. The one on the
device is actual hardware, while the other is
virtual and reacts to touch events.
Navigation Keys There are 5 basic navigation keys on the
device: center, left, right, up, and down. This
is used to positions the cursor on the screen
based on direction pressed, and the center
button is used to activate the item on the screen
highlighted by the cursor.
Dialog Box UI which takes a relatively large portion of the
5. screen but does not take up the entire screen.
This UI sits on top of the current activity as an
overlay.
High Level Use Cases
Use Case 1- the user starts a new game
John would like to start a game of Hangman for Android. John first powers on the
device, then is presented with the Android Home Screen. John has the Hangman
application installed on his Android device. He navigates to the Hangman icon and
touches the icon on the screen to launch the hangman application. John is presented with
the Hangman main screen. The main screen consists of for buttons: Continue, New
Game, About, and Exit. John decides he would like to start a new game of Hangman and
so touches the New Game button. John is presented with a dialog box with a list of
categories. The categories are Plant, Animal, and Insect. John touches the Animal
category, and is presented with the Hangman Game screen.
Actions:
1. Power on device
2. Touch Hangman application icon
3. Touch New Game button on Hangman Main Screen
4. Touch a Category in the new game dialog box
5. Start Playing
Use Case 2- the user continues an existing game
John is playing a game of Hangman and has not yet won or lost the game. He exits
the game using the back button on the device and hits the exit button on the Hangman
main screen. John’s application is now closed. He goes to the Library to study for an
exam. John returns from the Library, decides he would like to continue the same game
previously started but did not finish. He launches the Hangman application from the
home screen, and touches the Continue button on the Hangman main screen. John can
now see that he is at the same point in the Hangman game as was before he went to the
Library.
Actions:
1. Hit the back button on the device during game play
2. Touch the exit button on the Hangman main menu
3. Do some other activity, such as make a phone call
4. Touch the Hangman icon on the Home screen
6. 5. Touch the Continue button on the Hangman main screen
6. Proceed with playing the game from point you stopped
Use Case 3- the user plays the game using touch screen
Now that John has launched the Hangman application, and has started a new game he
will like to start guessing letters that are in the “mystery word”. The mystery word is
displayed on the game screen with underscores for each letter in the word separated by a
space. The game screen consists of a “3 by 3” grid of buttons on the lower half of the
screen, where each button corresponds to 3 letters except for the button corresponding to
the letters “Y” and “Z”, this button only corresponds to 2 letters. The starting Hangman
image is displayed on the upper half of the screen, which consists of just the Gallows and
no body parts revealed. John touches the button corresponding to letters “A”,”B”, and
“C”. A dialog box titled “Select a Letter” with 3 buttons labeled A, B, and C is shown.
John touches the button labeled “A” . The Game responds to his selection by revealing a
body part of the man to be hanged from the gallows. John’s guess was incorrect and so
the letter A is displayed on the screen to the right of the hangman image to signify a
wrong guess. John guesses again by touching the “STU” button. This reveals the “Select
A Letter” dialog with buttons “S”,”T”, and “U”. John touches the “T” button. The game
responds by revealing the Letter “T” as part of the mystery word. John’s guess was
correct.
Actions:
a. Touch the button on the screen corresponding to the group of letters your guess is
part of.
b. Touch the button corresponding to the letter the you want to guess
c. Touch another button to start another guess if you have not won or lost
Use Case 4- the user plays the game using the device keypad
John is playing a game of Hangman and wants to use the device’s keypad to play the
game. He pulls out the device keypad, the screen orientation is now in landscape mode
and the game adjusts the screen accordingly. John types a letter using the device keypad.
A body part of the Hangman is revealed and the letter corresponding to the key pressed is
displayed to signify a wrong guess. John hits the “C” key on the device keypad and is
revealed as part of the mystery word to signify a correct guess.
Actions:
1. Press a key on the device keypad to guess a letter
Use Case 5- the user plays the game using the navigation keys
Peter’s Android device does not support touch screen functionality. Peter must resort
to using the device’s navigation keys in order to select, deselect, and activate items on his
device screen. Peter would like to play Hangman on his device. After launching the
7. Hangman application he uses the navigation keys on his device to highlight each button
on the main screen. He activates the new game button by using the center button when
the button is highlighted. After choosing a Category using the same method as used for
selecting the buttons on the main screen, peter notices that he can play the Hangman
game navigating to a button in the “3 by 3” grid pressing the center button on his device
when the button is highlighted orange. game play proceeds as with using either of the
above input methods.
Actions:
1. Navigate to the button in which you want to activate
2. Press the center button to activate the selected button
Use Case 6- the user tries again after losing a game
Peter is at a point in the game where the next incorrect guess will result in a loss.
Peter presses the “Z” key on the device keypad. The game reveals the entire Hangman
image and displays the “Game Over” dialog box, with the message “You Lose”. Peter
would like to try again and so he touches the “Try Again” button in the Game over
dialog. A list of categories is displayed. Peter selects a category and starts to play a new
game.
Actions:
1. Touch the “Try Again” button in the Game Over dialog box after a loss
Use Case 7- the user tries again after winning a game
John is at a point in the game where the next correct guess will result in a win. John
presses the “A” key on the device keypad. The game reveals the Game Over dialog with
the “You Win” message. John would like to try again and so he touches the “Try Again”
button in the Game over dialog. A list of categories is displayed. John selects a category
and starts to play a new game.
Actions:
1. Touch the “Try Again” button in the Game Over dialog box after a win
Use Case 8- the user enables hints and music in the settings
Peter would like play the game using with hints and music enabled. At the Hangman
main screen he presses the device menu button. This in turn reveals a list of one item
label “Settings”. Peter touches the settings item which reveals a list of Settings items.
Here Peter makes sure that the corresponding checkboxes for hints and music is checked.
Peter uses the device back button to exit the setting menu and return back to the
Hangman main screen. Once at the main screen peter can hear the music playing in the
background.
Actions:
1. Press the device menu button while in main screen
8. 2. Touch the settings item in the menu list
3. Touch the checkbox of the item to enable or disable the item
4. Press the device back button to return to the main menu screen
Use Case 9- the user uses a hint during the game
John has just enabled hints in his settings and is ready to play the game. He touches
the new game button, touches a category from the new game dialog, and begins to play.
The length of the word John is trying to guess is 7 letters long. So far, he has not guessed
a letter correctly and has 3 incorrect guesses. John needs help and sees a button that
called “Hint” displayed under his incorrect guess. John touches the Hint button on the
game screen; the game in turn reveals one letter of the mystery word at random.
Actions:
1. Enable Hints in settings
2. Touch the hint button during game play to reveal 1 letter in the word
Tasks and Priorities
Function Priority
Continue an existing Game 1
Start a new Game 1
Play the game using device keypad 1
Play the game using touch screen 1
Play the game using navigation keys 1
Play Music in the Background 2
Provide Hints 2
Support for landscape screen orientation 1
Show animation for a wrong guess 3
Show game win screen 2
Show game lose screen 2
Allow the user to use the camera to insert themselves into the game as the 3
hangman
Allow the user to insert his/her own words into the word bank 3
Play a video tutorial when the user selects the About button on main screen 3
9. UI Mock-Ups and Storyboards
There are 3 main user interface screens for the Hangman game: Main Menu, Game, and
Settings. Other UI includes dialogs such as about, new game, keypad, win game and lose
game. Touch events are received through buttons which are placed conveniently on the
screen. All UI mockups were made using Microsoft Visio 2007 with The Android GUI
Prototyping Stencil from Artfulbits. Link
Main Menu Screen
View 1: This screen shall be displayed when the user first launches the application. This screen
consists of four buttons Continue, New Game, About, and Exit
10. New Game Dialog
View 2: Overlays the current main screen. This dialog will be displayed when the user touches the new
game button on the main screen, or when the user tries again after a win or loss. This dialog consists of a
list of three categories: Plant, Animal, and Insect.
11. About Dialog
View 3: This screen shall be displayed when the user touches the about button on the main menu.
It consists of a description of the Hangman game.
12. Game Screen
View 4: This screen shall be displayed when the user touches a category from the new game
dialog or touches the new game button from the main menu screen. It consists of a Hangman
image, a text field of incorrect guessed characters and a mystery word represented with
underscores.
13. Settings Item in Menu
View 5: This settings item shall be displayed upon pressing the menu button on the Android
device.
Settings
14. View 6: This settings menu shall be displayed upon touching the settings menu item. It consists
of list which contains a Music item and checkbox, and a Hints item with its corresponding
checkbox.
Game Screen (Landscape Mode)
View 7: This screen shall be displayed by tilting the Android device in its side and forcing it into
landscape mode.
15. Hint button
Hint Button
View 8: This button shall be displayed on the game screen when hints are enabled in the
settings.
16. Keypad Dialog
8:35 PM
Select A Letter
View 9: This dialog shall be displayed when the user selects a button from the “3 by 3” grid on
the game screen. It contains a button for each letter depending on which key is selected.
17. Game Over dialog
View 10: This dialog shall be displayed when the user has won a game. If the user has lost, the
message displayed is “You Lose!” instead. The dialog contains two buttons, “Try Again” and
“Back to Main”.
18. Hint Used message
View 11: This message shall be displayed once the user has used a hint. The hint button is no
longer displayed on the screen once it has been used.
19. Story Board 1: Launch Android Hangman and view About information
1. Touch the Android Hangman
Icon
2. Touch the About Button
3. View information about the
Hangman game.
20. Story Board 2: Start a New Hangman Game
1. Touch the New Game button
2. Touch a Category
3. Start Playing
21. Story Board 3: Guess a letter correctly
1. Touch a key on the “3x3”
virtual keypad
2. Touch the key you would like
to guess
3. Watch the mystery letter update
with the selected guessed letter
22. Story Board 4: Guess a letter incorrectly
1. Touch a key on the “3x3”
virtual keypad
2. Touch the key you would like
to guess
3. Watch the wrong letter list
update with the selected guessed
letter
4. Watch a body part of the
hangman be revealed
23. Story Board 5: Enable hints in the Settings
1. Press the menu button on the
device at the main menu screen
2. Touch the Settings item in the
menu list
3. Check the Hints check box
25. Sequence Diagrams
Show keypad dialog sequence
User Game Dialog
onClick(keypadButton)
showDialog(Dialog_ID)
onCreateDialog(Dialog_ID)
Create(context)
setContentView(xmlresource)
setClickListeners()
setTitle(String)
bindViews(Button,Button,Button)
setText(Button,Button,Button)
setClickListeners(Button,Button,Button)
show()
26. Start new game sequence
User Main Screen Alert Dialog
onClick(newgameButton)
openNewGameDialog()
Create(context)
setTitle(String)
setClickListeners()
setItems(categories)
setClickListeners(categories)
show()
onClick(category)
startGame(category)
27. Validate guess sequence
User Game Dialog
onClick(Button)
onClick(Button_ID)
getkeyPressed()
validateGuess(key)
dismiss()
removed
alt [if guess==invalid]
checkRepeatedGuess()
alt [if guess not found]
updateWrongGuesses(guess)
updateImage()
checkLose()
alt [else if guess==valid]
updateMystWord(guess)
checkWin()
28. Use Case Diagrams
Main Menu use case
Hangman Application
Continue
existing Game
Start New
game
Read About the
game
User
Exit the Game
Game use case
Hangman Application
Guess letter
using onscreen
keypad
Guess letter
using hardware
keyboard
Put device in
landscape
User mode
Use Hint button
29. Basic System Components
Hardware Components
The Hangman Application shall run on both the T-mobile G1 and the Google Android
Development Phone 1.
Specs:
• Touch screen
• Trackball
• 3.2 megapixel camera with autofocus
• Wi-Fi
• GPS-enabled
• Bluetooth v2.0
• Handsfree profile v1.5
• Headset profile v1.0
• 3G WCDMA (1700/2100 MHz)
• Quad-band GSM (850/900/1800/1900 MHz)
• QWERTY slider keyboard
• Includes 1GB MicroSD card (can be replaced with up to 16GB card)
Software Components
The following is a list of basic software components used to develop the Hangman Android
application.
• Eclipse IDE 3.4 Ganymede
• ADT Plugin v. 0.95 for Eclipse
• Java Runtime Environment JRE v.1.6
• Android SDK v1.6 – API level 4
• EUML2 Plugin for Eclipse- used to generate UML class diagrams.
30. Application Architecture
Activities
The Activity classes shall control/manipulate the Views displayed on the screen. They shall
act as our controller, providing all the business logic for the Hangman game and main screen.
Activities shall be implemented using Java code. The application shall transition from one
screen to the other by handling each state of an activity’s lifecycle. This shall be necessary to
ensure the state of the application is preserved when the user returns to the application after
leaving.
Hangman Activity
Controls views associated with the Hangman Main Menu screen. The associated
views are 4 buttons: Continue, New Game, about, and Exit. It also handles the
transition from main screen to game screen.
Game Activity
Controls views associated with the Hangman Game screen. The associated views are
2 TextViews: one for the Mystery word, and the other for the wrong letters guessed,
10 buttons: one for the hint button, and the other for each key in the keypad. This
activity handles all game logic, guess validation, and checking for a win or loss.
Views
All Views in the application shall be defined in XML files. XML resource files shall be
inflated so that the properties of the XML layout may be manipulated by the controller or
Activity which sets its content to the view. With XML the developer does not need a canvas
in order to draw, unlike with Java code. XML layouts are defined in a hierarchal manner
each view nested within another view, completely separated from the Java code. This
provides a clear separation of presentation from business logic.
31. View hierarchy
Root of Android Layout
Defined in XML, this is
where the developer will
start to define his layout.
Each child is nested within
the root.
The above is a sample xml layout hierarchy from the Android Hangman application.
Specifically this view defines what the user sees when the phone is in landscape mode
while the user is on the game screen. See game.xml in res/layout-land for more
information.
Basic Development Strategy
The first step in my development strategy was to build off the use cases and start
constructing my XML layouts. Ideally if I were developing in a team I could have developed
my UI and classes concurrently, and to some respect I sort of did. While building my XML
Layouts I knew I would need a corresponding activity class in order to handle each button
click, keypad press and so on.
The next step was to flesh out my classes especially the Game class. To keep screen
transitions simple a dialog was used to transition the user from one screen to the next. A
total of 3 screens were built, Main screen, Settings screen, and Game screen. For the Game
screen I needed to handle basic user input in order to easily debug my game logic from the
phone. Once I had one basic method of input in place, all other methods of input would
follow the same path to guess validation. With basic input in place I could use it to test the
manipulation of each view on the screen. Saving the state of my application was one of my
32. first priorities so to test this I would place the the phone from landscape to portrait mode and
vice versa, this essentially killed the current activity and started a new instance of the
activity. The next step was to implement guess validation.
After guess validation was set in place. All that was left to do was close the loop by
handling what would happen when the user lost or won the game. From there I was able to
add extensions to the application such as music and hints.
Version control was a must. Each version of the application represented a clear logical
break. I think I must have ended up with about 7 versions of the code.
Appendix
Game Screen Shots
Hangman Main Screen
38. private static final String TAG = "Hangman";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set content view to main layout
setContentView(R.layout.main);
// set OnClick Listeners for each button in the view
Button continueButton = (Button)
this.findViewById(R.id.continuebtn);
// continue button
continueButton.setOnClickListener(this);
Button newgameButton = (Button)
this.findViewById(R.id.newgamebtn);
// new game button
newgameButton.setOnClickListener(this);
Button aboutButton = (Button)
this.findViewById(R.id.aboutbtn);
// about button
aboutButton.setOnClickListener(this);
Button exitButton = (Button)
this.findViewById(R.id.exitbtn);
// exit button
exitButton.setOnClickListener(this);
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onResume()
*/
@Override
protected void onResume() {
super.onResume();
Music.play(this, R.raw.main);
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onPause()
*/
@Override
protected void onPause() {
super.onPause();
Music.stop(this);
}
/*
* (non-Javadoc)
*
* @see
android.app.Activity#onCreateOptionsMenu(android.view.Menu)
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
39. super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
/*
* (non-Javadoc)
*
* @see
android.app.Activity#onOptionsItemSelected(android.view.MenuItem)
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Log.d(TAG, "Hangman -> onOptionsItemSelected(...)");
switch (item.getItemId()) {
case R.id.settings:
startActivity(new Intent(this, Settings.class));
return true;
// More items go here (if any) ...
}
return false;
}
/*
* (non-Javadoc)
*
* @see
android.view.View.OnClickListener#onClick(android.view.View)
*/
public void onClick(View v) {
switch (v.getId()) {
case R.id.continuebtn:
// continue old game
startGame(Game.CATEGORY_CONTINUE);
break;
case R.id.newgamebtn:
// open a new game dialog box
openNewGameDialog();
break;
case R.id.aboutbtn:
// start about activity
Intent i = new Intent(this, About.class);
startActivity(i);
break;
case R.id.exitbtn:
// exit game
finish();
break;
}
}
/** Ask the user what category they want */
private void openNewGameDialog() {
new AlertDialog.Builder(this).setTitle("Choose a
Category").setItems(
40. R.array.category, new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface
dialoginterface, int i) {
startGame(i);
}
}).show();
}
/** Start a new game with the given category */
private void startGame(int i) {
Log.d(TAG, "clicked on " + i);
Intent intent = new Intent(Hangman.this, Game.class);
intent.putExtra(Game.KEY_CATEGORY, i);
startActivity(intent);
}
}
Game.java
package com.android.vgalleg1.hangman;
import java.util.Random;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
/**
* @author Victor Gallego
* @email vgalleg1@fau.edu
*/
public class Game extends Activity implements OnClickListener {
private static final String TAG = "Game";
/** The View of the mystery word that is to be guessed */
private TextView mystword;
/** The View of the string of letters guessed incorrectly */
private TextView wrongletters;
/** The View of the displayed Hangman image */
private ImageView hangmanimg;
/** The View of the hint button in game */
private Button hintbutton;
/** The Dialog currently in the foreground during the game */
private Dialog dialog;
41. /** The id of the Dialog currently in the foreground */
private int currentDialogId;
private int numWrongGuesses;
private String mysteryWord;
private Boolean hintused = false;
private int cat;
static final int DIALOG_ABC_ID = 1;
static final int DIALOG_DEF_ID = 2;
static final int DIALOG_GHI_ID = 3;
static final int DIALOG_JKL_ID = 4;
static final int DIALOG_MNO_ID = 5;
static final int DIALOG_PQR_ID = 6;
static final int DIALOG_STU_ID = 7;
static final int DIALOG_VWX_ID = 8;
static final int DIALOG_YZ_ID = 9;
static final int DIALOG_WIN_ID = 10;
static final int DIALOG_LOSE_ID = 11;
static final String KEY_CATEGORY =
"com.android.vgalleg1.hangman.category";
public static final int CATEGORY_PLANT = 0;
public static final int CATEGORY_ANIMAL = 1;
public static final int CATEGORY_INSECT = 2;
protected static final int CATEGORY_CONTINUE = -1;
private static final String PREF_MYSTWORD = "mystword";
private static final String PREF_MYSTERYWORD = "mysterytword";
private static final String PREF_WRONGLETTERS = "wrongletters";
private static final String PREF_NUMWRONGGUESSES =
"numWrongGuesses";
private static final String PREF_HINTUSED = "hintused";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set content view to game layout
setContentView(R.layout.game);
// bind the resource views to textview and imageview
holders
bindViews();
// get selected category and assign mystery word
setWordByCategory();
// initialize the Mystery word view with underscores
initMystWord();
// initialize the number of wrong guesses and wrong guesses
view string
initWrongGuesses();
42. // initialize hangman imageview
initImg();
// set OnClick Listeners for each button in the view
setClickListeners();
// load game if saved
loadGameIfSaved();
}
/** Called when the activity is resumed. Plays music if enabled
*/
@Override
protected void onResume() {
super.onResume();
Music.play(this, R.raw.game);
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onPause()
*/
@Override
protected void onPause() {
super.onPause();
Log.d(TAG, "onPause");
Music.stop(this);
// Save the current mystery word
getPreferences(MODE_PRIVATE).edit().putString(PREF_MYSTERYWORD,
mysteryWord).commit();
getPreferences(MODE_PRIVATE).edit().putString(PREF_MYSTWORD,
mystword.getText().toString()).commit();
getPreferences(MODE_PRIVATE).edit().putString(PREF_WRONGLETTERS,
wrongletters.getText().toString()).commit();
getPreferences(MODE_PRIVATE).edit().putInt(PREF_NUMWRONGGUESSES,
numWrongGuesses).commit();
getPreferences(MODE_PRIVATE).edit().putBoolean(PREF_HINTUSED,
hintused)
.commit();
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onKeyDown(int,
android.view.KeyEvent)
*/
43. @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_A:
validateGuess('A');
break;
case KeyEvent.KEYCODE_B:
validateGuess('B');
break;
case KeyEvent.KEYCODE_C:
validateGuess('C');
break;
case KeyEvent.KEYCODE_D:
validateGuess('D');
break;
case KeyEvent.KEYCODE_E:
validateGuess('E');
break;
case KeyEvent.KEYCODE_F:
validateGuess('F');
break;
case KeyEvent.KEYCODE_G:
validateGuess('G');
break;
case KeyEvent.KEYCODE_H:
validateGuess('H');
break;
case KeyEvent.KEYCODE_I:
validateGuess('I');
break;
case KeyEvent.KEYCODE_J:
validateGuess('J');
break;
case KeyEvent.KEYCODE_K:
validateGuess('K');
break;
case KeyEvent.KEYCODE_L:
validateGuess('L');
break;
case KeyEvent.KEYCODE_M:
validateGuess('M');
break;
case KeyEvent.KEYCODE_N:
validateGuess('N');
break;
case KeyEvent.KEYCODE_O:
validateGuess('O');
break;
case KeyEvent.KEYCODE_P:
validateGuess('P');
break;
case KeyEvent.KEYCODE_Q:
validateGuess('Q');
break;
case KeyEvent.KEYCODE_R:
validateGuess('R');
break;
44. case KeyEvent.KEYCODE_S:
validateGuess('S');
break;
case KeyEvent.KEYCODE_T:
validateGuess('T');
break;
case KeyEvent.KEYCODE_U:
validateGuess('U');
break;
case KeyEvent.KEYCODE_V:
validateGuess('V');
break;
case KeyEvent.KEYCODE_W:
validateGuess('W');
break;
case KeyEvent.KEYCODE_X:
validateGuess('X');
break;
case KeyEvent.KEYCODE_Y:
validateGuess('Y');
break;
case KeyEvent.KEYCODE_Z:
validateGuess('Z');
break;
default:
return super.onKeyDown(keyCode, event);
}
return true;
}
/*
* (non-Javadoc)
*
* @see
android.view.View.OnClickListener#onClick(android.view.View)
*/
public void onClick(View v) {
Log.d(TAG, "clicked on " + v.getId());
Toast toast;
switch (v.getId()) {
case R.id.abc_button:
// ABC
showDialog(DIALOG_ABC_ID);
break;
case R.id.def_button:
// DEF
showDialog(DIALOG_DEF_ID);
break;
case R.id.ghi_button:
// GHI
showDialog(DIALOG_GHI_ID);
break;
case R.id.jkl_button:
// JKL
showDialog(DIALOG_JKL_ID);
break;
case R.id.mno_button:
45. // MNO
showDialog(DIALOG_MNO_ID);
break;
case R.id.pqr_button:
// PQR
showDialog(DIALOG_PQR_ID);
break;
case R.id.stu_button:
// STU
showDialog(DIALOG_STU_ID);
break;
case R.id.vwx_button:
// VWX
showDialog(DIALOG_VWX_ID);
break;
case R.id.yz_button:
// YZ
showDialog(DIALOG_YZ_ID);
break;
case R.id.keypad1:
// first button in Keypad Dialog
validateGuess(getKeyPressed(currentDialogId,
v.getId()));
break;
case R.id.keypad2:
// second button in Keypad Dialog
validateGuess(getKeyPressed(currentDialogId,
v.getId()));
break;
case R.id.keypad3:
// third button in Keypad Dialog
validateGuess(getKeyPressed(currentDialogId,
v.getId()));
break;
case R.id.endgame1:
openNewGameDialog();
break;
case R.id.endgame2:
finish();
break;
case R.id.hint_button:
// do hint
toast = Toast.makeText(this, "Hint Used",
Toast.LENGTH_SHORT);
toast.show();
useHint();
hintused = true;
hintbutton.setVisibility(View.GONE);
break;
}
}
/*
* (non-Javadoc)
*
* @see android.app.Activity#onCreateDialog(int)
*/
46. protected Dialog onCreateDialog(int id) {
// buttons for keypad
Button keypad1;
Button keypad2;
Button keypad3;
// views for end game dialog
TextView endmessege;
Button endgame1;
Button endgame2;
switch (id) {
case DIALOG_ABC_ID:
currentDialogId = id;
// do the work to define the ABC Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("A");
keypad2.setText("B");
keypad3.setText("C");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_DEF_ID:
currentDialogId = id;
// do the work to define the DEF Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("D");
keypad2.setText("E");
keypad3.setText("F");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_GHI_ID:
currentDialogId = id;
// do the work to define the GHI Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("G");
keypad2.setText("H");
keypad3.setText("I");
keypad1.setOnClickListener(this);
47. keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_JKL_ID:
currentDialogId = id;
// do the work to define the JKL Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("J");
keypad2.setText("K");
keypad3.setText("L");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_MNO_ID:
currentDialogId = id;
// do the work to define the MNO Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("M");
keypad2.setText("N");
keypad3.setText("O");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_PQR_ID:
currentDialogId = id;
// do the work to define the PQR Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("P");
keypad2.setText("Q");
keypad3.setText("R");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_STU_ID:
currentDialogId = id;
// do the work to define the STU Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
48. keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("S");
keypad2.setText("T");
keypad3.setText("U");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_VWX_ID:
currentDialogId = id;
// do the work to define the VWX Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("V");
keypad2.setText("W");
keypad3.setText("X");
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
keypad3.setOnClickListener(this);
break;
case DIALOG_YZ_ID:
currentDialogId = id;
// do the work to define the YZ Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.keypad_dialog);
dialog.setTitle("Select A Letter");
keypad1 = (Button) dialog.findViewById(R.id.keypad1);
keypad2 = (Button) dialog.findViewById(R.id.keypad2);
keypad3 = (Button) dialog.findViewById(R.id.keypad3);
keypad1.setText("Y");
keypad2.setText("Z");
keypad3.setText("_");
keypad3.setVisibility(View.GONE);
keypad1.setOnClickListener(this);
keypad2.setOnClickListener(this);
break;
case DIALOG_WIN_ID:
currentDialogId = id;
// do the work to define the WIN Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.endgame_dialog);
dialog.setTitle("Game Over");
endmessege = (TextView)
dialog.findViewById(R.id.endmessage);
endgame1 = (Button)
dialog.findViewById(R.id.endgame1);
endgame2 = (Button)
dialog.findViewById(R.id.endgame2);
endmessege.setText("You Win!");
endgame1.setText("Play Again");
endgame2.setText("Back To Main");
49. endgame1.setOnClickListener(this);
endgame2.setOnClickListener(this);
break;
case DIALOG_LOSE_ID:
currentDialogId = id;
// do the work to define the LOSE Dialog
dialog = new Dialog(Game.this);
dialog.setContentView(R.layout.endgame_dialog);
dialog.setTitle("Game Over");
endmessege = (TextView)
dialog.findViewById(R.id.endmessage);
endgame1 = (Button)
dialog.findViewById(R.id.endgame1);
endgame2 = (Button)
dialog.findViewById(R.id.endgame2);
endmessege.setText("You Lose!");
endgame1.setText("Try Again");
endgame2.setText("Back To Main");
endgame1.setOnClickListener(this);
endgame2.setOnClickListener(this);
break;
default:
dialog = null;
}
return dialog;
}
/**
* @Summary Determines which Key was pressed in the Dialog based
on Dialog ID
* and Keypad button ID. and will return the value as a
char.
* @author vgalleg1
* @param dialogId
* @param keyId
* @return character corresponding to the pressed key on keypad
*/
private char getKeyPressed(int dialogId, int keyId) {
char temp = '0';
switch (dialogId) {
case DIALOG_ABC_ID:
if (keyId == R.id.keypad1) {
temp = 'A';
} else if (keyId == R.id.keypad2) {
temp = 'B';
} else if (keyId == R.id.keypad3) {
temp = 'C';
}
break;
case DIALOG_DEF_ID:
if (keyId == R.id.keypad1) {
temp = 'D';
} else if (keyId == R.id.keypad2) {
temp = 'E';
} else if (keyId == R.id.keypad3) {
temp = 'F';
}
50. break;
case DIALOG_GHI_ID:
if (keyId == R.id.keypad1) {
temp = 'G';
} else if (keyId == R.id.keypad2) {
temp = 'H';
} else if (keyId == R.id.keypad3) {
temp = 'I';
}
break;
case DIALOG_JKL_ID:
if (keyId == R.id.keypad1) {
temp = 'J';
} else if (keyId == R.id.keypad2) {
temp = 'K';
} else if (keyId == R.id.keypad3) {
temp = 'L';
}
break;
case DIALOG_MNO_ID:
if (keyId == R.id.keypad1) {
temp = 'M';
} else if (keyId == R.id.keypad2) {
temp = 'N';
} else if (keyId == R.id.keypad3) {
temp = 'O';
}
break;
case DIALOG_PQR_ID:
if (keyId == R.id.keypad1) {
temp = 'P';
} else if (keyId == R.id.keypad2) {
temp = 'Q';
} else if (keyId == R.id.keypad3) {
temp = 'R';
}
break;
case DIALOG_STU_ID:
if (keyId == R.id.keypad1) {
temp = 'S';
} else if (keyId == R.id.keypad2) {
temp = 'T';
} else if (keyId == R.id.keypad3) {
temp = 'U';
}
break;
case DIALOG_VWX_ID:
if (keyId == R.id.keypad1) {
temp = 'V';
} else if (keyId == R.id.keypad2) {
temp = 'W';
} else if (keyId == R.id.keypad3) {
temp = 'X';
}
break;
case DIALOG_YZ_ID:
if (keyId == R.id.keypad1) {
51. temp = 'Y';
} else if (keyId == R.id.keypad2) {
temp = 'Z';
}
break;
}
return temp;
}
/**
* validates the player's guess if invalid checks if they lost,
checks if
* they won if their guess is valid
*
* @param guess
*/
private void validateGuess(char guess) {
if (dialog != null) {
// remove from current view
dialog.dismiss();
// clean up
removeDialog(currentDialogId);
}
if (mysteryWord.indexOf(guess) == -1) {
// Check if letter already exists
String wrongletters_t =
wrongletters.getText().toString();
if (wrongletters_t.indexOf(guess) == -1) {
// Letter not found in word
if (numWrongGuesses < 6) {
numWrongGuesses++;
updateWrongGuesses(guess);
updateImg();
}
checkLose();
}
} else {
// Update word with guessed letter
if (numWrongGuesses < 6) {
updateMystWord(guess);
checkWin();
} else {
checkLose();
}
}
}
/**
* converts the textview to a view with underscores and spaces
*
* @return
*/
private String underscore() {
StringBuffer result = new StringBuffer();
for (int i = 0; i < mysteryWord.length(); i++) {
52. result.append("_ ");
}
return result.toString();
}
/**
* sets the Hangman image to the starting image
*/
private void initImg() {
hangmanimg.setImageResource(R.drawable.hangman_img0);
}
/**
* updates the Hangman image based on the number of wrong guesses
*/
private void updateImg() {
switch (numWrongGuesses) {
case 0:
hangmanimg.setImageResource(R.drawable.hangman_img0);
break;
case 1:
hangmanimg.setImageResource(R.drawable.hangman_img1);
break;
case 2:
hangmanimg.setImageResource(R.drawable.hangman_img2);
break;
case 3:
hangmanimg.setImageResource(R.drawable.hangman_img3);
break;
case 4:
hangmanimg.setImageResource(R.drawable.hangman_img4);
break;
case 5:
hangmanimg.setImageResource(R.drawable.hangman_img5);
break;
case 6:
hangmanimg.setImageResource(R.drawable.hangman_img6);
break;
default:
hangmanimg.setImageResource(R.drawable.hangman_img0);
}
}
/**
* sets the View of Mystery Word to a text view with underscores
and spaces
*/
private void initMystWord() {
mystword.setText(underscore());
}
/**
* updates the View of the Mystery Word to display all
occurrences of the
* passed character
*
53. * @param ch
*/
private void updateMystWord(char ch) {
char[] updatedWord =
mystword.getText().toString().toCharArray();
for (int i = 0; i < mysteryWord.length(); i++) {
if (ch == mysteryWord.charAt(i)) {
updatedWord[i * 2] = mysteryWord.charAt(i);
}
}
mystword.setText(new String(updatedWord));
}
/**
* sets the number of wrong guesses to zero wrongGuesses string
to empty
*/
private void initWrongGuesses() {
numWrongGuesses = 0;
wrongletters.setText("");
}
/**
* updates the View of wrong guesses with the recent wrong guess
*/
private void updateWrongGuesses(char ch) {
wrongletters.setText(wrongletters.getText() +
Character.toString(ch));
}
/**
* gets the word from the word bank based on the category
*
* @param cat
* @return temp
*/
private String getWord(int cat) {
String temp;
switch (cat) {
case CATEGORY_CONTINUE:
temp =
getPreferences(MODE_PRIVATE).getString(PREF_MYSTERYWORD,
getWord(CATEGORY_PLANT));
break;
case CATEGORY_PLANT:
temp = "KNIGHTIA";
break;
case CATEGORY_ANIMAL:
temp = "LEOPARD";
break;
case CATEGORY_INSECT:
temp = "PICKLEWORM";
break;
default:
temp = "DEFAULT";
}
return temp;
54. }
/**
* binds each manipulated view to a private variable
*/
private void bindViews() {
mystword = (TextView) this.findViewById(R.id.mysteryword);
wrongletters = (TextView)
this.findViewById(R.id.wrongletters);
hangmanimg = (ImageView)
this.findViewById(R.id.hangman_img);
}
/**
* Sets the mystery word based on the current category
*/
private void setWordByCategory() {
cat = getIntent().getIntExtra(KEY_CATEGORY,
CATEGORY_PLANT);
mysteryWord = getWord(cat);
}
/**
* Sets button click listeners for each button on the screen
*/
private void setClickListeners() {
Button abc = (Button) this.findViewById(R.id.abc_button);
// abc button
abc.setOnClickListener(this);
Button def = (Button) this.findViewById(R.id.def_button);
// def button
def.setOnClickListener(this);
Button ghi = (Button) this.findViewById(R.id.ghi_button);
// ghi button
ghi.setOnClickListener(this);
Button jkl = (Button) this.findViewById(R.id.jkl_button);
// jkl button
jkl.setOnClickListener(this);
Button mno = (Button) this.findViewById(R.id.mno_button);
// mno button
mno.setOnClickListener(this);
Button pqr = (Button) this.findViewById(R.id.pqr_button);
// pqr button
pqr.setOnClickListener(this);
Button stu = (Button) this.findViewById(R.id.stu_button);
// stu button
stu.setOnClickListener(this);
Button vwx = (Button) this.findViewById(R.id.vwx_button);
// vwx button
vwx.setOnClickListener(this);
Button yz = (Button) this.findViewById(R.id.yz_button);
// yz button
yz.setOnClickListener(this);
// hint button
hintbutton = (Button) this.findViewById(R.id.hint_button);
55. hintbutton.setOnClickListener(this);
if (!Settings.getHints(this)) {
hintbutton.setVisibility(View.GONE);
}
}
/**
* Loads the old Game if game was saved
*/
private void loadGameIfSaved() {
if (cat == -1) {
mysteryWord = getPreferences(MODE_PRIVATE).getString(
PREF_MYSTERYWORD, getWord(cat));
mystword.setText(getPreferences(MODE_PRIVATE).getString(
PREF_MYSTWORD, underscore()));
wrongletters.setText(getPreferences(MODE_PRIVATE).getString(
PREF_WRONGLETTERS, ""));
numWrongGuesses =
getPreferences(MODE_PRIVATE).getInt(
PREF_NUMWRONGGUESSES, 0);
hintused =
getPreferences(MODE_PRIVATE).getBoolean(PREF_HINTUSED,
false);
if (hintused || !Settings.getHints(this)) {
hintbutton.setVisibility(View.GONE);
}
updateImg();
} else {
mystword.setText(underscore());
}
// If the activity is restarted, do a continue next time
getIntent().putExtra(KEY_CATEGORY, CATEGORY_CONTINUE);
}
/**
* checks to see if player has won the game
*/
private void checkWin() {
if (mystword.getText().toString().indexOf("_ ") == -1) {
showDialog(DIALOG_WIN_ID);
}
}
/**
* checks to see if the player has lost the game
*/
private void checkLose() {
if (numWrongGuesses == 6) {
showDialog(DIALOG_LOSE_ID);
56. }
}
/** Ask the user what category they want */
private void openNewGameDialog() {
new AlertDialog.Builder(this).setTitle("Choose a
Category").setItems(
R.array.category, new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface
dialoginterface, int i) {
startGame(i);
}
}).show();
}
/**
* Reveal the a random letter of the mystery word
*/
private void useHint() {
Random generator = new Random();
int rand=generator.nextInt(mysteryWord.length());
Log.d(TAG, "index chosen: " + rand);
validateGuess(mysteryWord.charAt(rand));
}
/** Start a new game with the given category */
private void startGame(int i) {
Log.d(TAG, "clicked on " + i);
Intent intent = new Intent(Game.this, Game.class);
intent.putExtra(Game.KEY_CATEGORY, i);
startActivity(intent);
finish();
}
}
About.java
package com.android.vgalleg1.hangman;
import android.app.Activity;
import android.os.Bundle;
public class About extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about);
}
}
Settings.java
package com.android.vgalleg1.hangman;
import android.content.Context;
import android.os.Bundle;
import android.preference.PreferenceActivity;
57. import android.preference.PreferenceManager;
public class Settings extends PreferenceActivity {
// Option names and default values
private static final String OPT_MUSIC = "music";
private static final boolean OPT_MUSIC_DEF = true;
private static final String OPT_HINTS = "hints";
private static final boolean OPT_HINTS_DEF = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
}
/** Get the current value of the music option */
public static boolean getMusic(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(OPT_MUSIC, OPT_MUSIC_DEF);
}
/** Get the current value of the hints option */
public static boolean getHints(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(OPT_HINTS, OPT_HINTS_DEF);
}
}
Music.java
package com.android.vgalleg1.hangman;
import android.content.Context;
import android.media.MediaPlayer;
public class Music {
private static MediaPlayer mp = null;
/** Stop old song and start new one */
public static void play(Context context, int resource) {
stop(context);
// Start music only if not disabled in preferences
if (Settings.getMusic(context)) {
mp = MediaPlayer.create(context, resource);
mp.setLooping(true);
mp.start();
}
}
/** Stop the music */
public static void stop(Context context) {
if (mp != null) {
mp.stop();
mp.release();