Creation of an Android App By Keith Lynn

Slides:



Advertisements
Similar presentations
Chapter 18 Building the user interface. This chapter discusses n Javas graphical user interface. n Swing: an enhancement of a library called the Abstract.
Advertisements

Android User Interface
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Mobile Computing Lecture#13. Lecture Contents 2 Widgets  Creating App Widget  Unsupported/Supported Views/Layouts  Widget Layout  Widget Settings.
User Interface Classes.  Design Principles  Views & Layouts  Event Handling  Menus  Dialogs.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Android Development (Basics)
Android: Layouts David Meredith
Introduction to Android Programming Content Basic environmental structure Building a simple app Debugging.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Introducing the Sudoku Example
Android: versions Note that: Honeycomb (Android v3.0) A tablet-only release Jelly Bean (Android v4.1) Released on July 09, 2012.
CS5103 Software Engineering Lecture 08 Android Development II.
Chapter 9: Customize! Navigating with Tabs on a Tablet App.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Android Layouts. Layouts Define the user interface for an activity Layouts are defined in.xml files – within /res/layout folder – different layout can.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
Basic Android Tutorial USF’s Association for Computing Machinery.
Field Trip #26 Create a Find a Word Puzzle in Java By Keith Lynn.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
Chapter 2 The Android User Interface. Objectives  In this chapter, you learn to:  Develop a user interface using the TextView, ImageView, and Button.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
SpotOn Game App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Android Boot Camp for Developers Using Java, 3E
User Interfaces: Part 1 (View Groups and Layouts).
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Field Trip #31 CrossWord Puzzle By Keith Lynn. JApplet A JApplet is a top-level container in Java We will use the JApplet to contain two Jpanels The first.
Field Trip #32 Digital Alarm Clock By Keith Lynn.
ANDROID – DRAWING IMAGES – SIMPLE EXAMPLE IN INTERFACE AND EVENT HANDLING L. Grewe.
Field Trip #23 Hangman By Keith Lynn. JApplet A JApplet is a top-level container An applet is a small Java program that is executed by another program.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
Building User Interfaces Basic Applications
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Field Trip #30 A Memory Game By Keith Lynn. View A View is the basic building block of an app Some Views hold other views An example of this is GridLayout.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Menus. Menus are a common user interface component in many types of applications. The options menu is the primary collection of menu items for an activity.
Chapter 2: Simplify! The Android User Interface
Lab7 – Appendix.
Java FX: Scene Builder.
Open Handset Alliance.
Android – Event Handling
Mobile Application Development Chapter 3 [Using Eclipse Android Studio for Android Development] IT448-Fall 2017 IT448- Fall2017.
Android Boot Camp for Developers Using Java, 3E
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Visual programming Chapter 1: Introduction
Mobile Computing With Android ACST 4550 XML and the Android GUI
Android SDK & App Development
Chapter 3: Coding the GUI Programmatically, Layout Managers
CIS 470 Mobile App Development
Android Layout Basics Topics
CS323 Android Getting Started
CS5103 Software Engineering
Building User Interfaces Basic Applications
CIS 470 Mobile App Development
Android SDK & App Development
Mobile Programming Gestures in Android.
Android Project Structure, App Resources and Event Handling
User Interface Screen Elements
Android Sensor Programming
UI Elements 2.
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

Creation of an Android App By Keith Lynn Field Trip #18 Creation of an Android App By Keith Lynn

The Manifest File When a new Android Project is created, a xml document is created This document specifies attributes of the project If your project needs to use the Internet, you will have to give permission in the manifest Also if you use various libraries like OpenGL, you can specify the version you're using in the manifest

Activities Each Android App consists of an Activity An Activity defines what your App does In the Main Activity of the project, you decide what the application will look like This involves defining the content In order to define the content, we set a content View The View will contain all of the components in the app, and is the interface to the user

Views A View is the basic user component. View is the superclass of all views. There are simple views like TextView that will display text and ImageView that will display images There are also groups of views like RelativeLayout and LinearLayout that allow us to place multiple components in the view

Creating Views To create a View, we have to specify its context The context of the View is typically the main activity Every view that is created is part of a context

Widgets Widgets are components like buttons that can be added to a view We can also add a TextView to display text or an EditText that allows an app to receive information Other widgets are ImageViews and Spinners In order to create our own widget, we can subclass View or one of its subclasses

Listeners When we place components on a View, there are times we would like to respond to events such as clicking a button or touching the screen In order to detect and act on these events, we need to create an instance of a listener and attach it to the component A typical Listener is onTouchListener This is an interface found in the View class If we implement the onTouchListener, we must implement the method onTouch

Images Images are file like jpg and gif that we can place on an App In order to place the image on the app, we create an ImageView To add the image to our app, we drag the image to one of the drawable folders in the project A special id is then created for that image and store in R.java We then create an instance of a Drawable object using that id

Images, cont'd For example, if our image is called test.jpg, we drag it into one of the drawable folders The id created for the image is then R.drawable.test (Note we can't have two images with the same name even if they have different extensions) We then create the Drawable object with getResources().getDrawable(R.drawable.test) We place it in the ImageView with the method setImageDrawable

Sounds We can also include sounds like wav files in our App In order to use a sound file, we create a folder called raw in the res folder in the project We then drag the sound file to raw An id will be created in R.java We create an instance of a MediaPlayer by calling the method create(Context,R.raw.test) where test the name of the sound file Then we can call the start method

Tic Tac Toe As a demonstration of an app, let's consider a simple Tic Tac Toe game In order to create this game, we will create a 3x3 grid and allow users to click in that grid and display alternating letters x and o The game is over when one row, column, or diagonal is filled with one symbol

Creating the Board We will create the board by using a special view called a RelativeLayout The RelativeLayout allows us to place components on the App and then specify where those components should be placed relative to other components We can define the size of our components by creating an instance of RelativeLayout.LayoutParams and specifying width and height

Defining the characters We will use images to indicate characters We will drag images of x and o into a drawable folder We then create a special variable called currentCharacter that will refer initially to the image of x When then user touches the grid, the current character will be displayed in the position indicated Then currentCharacter will alternate

Event Handling In order to determine which row and column was selected, we add a special value called a tag to the ImageView When we handle the event, we will retrieve the tag and this determines which row and column was selected This allows us to then display the character on the row and column

Determining who won To determine who won, we examine each row, column and diagonal If any row, column, or diagonal contain all of the same character, that character wins We then display a message on the screen To prevent characters from being displayed on the grid after the game is over, we create a boolean We only allow a character to be placed on the grid if the boolean is not true