Introducing the Sudoku Example

Slides:



Advertisements
Similar presentations
Google Android Introduction to Mobile Computing. Android is part of the build a better phone process Open Handset Alliance produces Android Comprises.
Advertisements

Android Application Development Tutorial. Topics Lecture 6 Overview Programming Tutorial 3: Sending/Receiving SMS Messages.
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
CE881: Mobile and Social Application Programming Simon M. Lucas Layouts.
Chapter 6: Jam! Implementing Audio in Android Apps.
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
User Interface Android Applications. Activities An activity presents a visual user interface. Each activity is given a default window to draw in. The.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Android Programming Beomjoo Seo Sep., 12 CS5248 Fall 2012.
Android Application Development with Java UPenn CS4HS 2011 Chris Murphy
Android Development (Basics)
Android Application Development 2013 PClassic Chris Murphy 1.
Creating Android user interfaces using layouts 1Android user interfaces using layouts.
Better reference the original webpage :
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.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Web Design Using HTML Codes. WHAT DO I NEED TO BEGIN DESIGNING A HOME PAGE? 1.YOU NEED A FOLDER (also called a DIRECTORY) You should set up a folder or.
CS5103 Software Engineering Lecture 08 Android Development II.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
Exploring 2D Graphics: The Sudoku Example Content taken from book: “Hello, Android” by Ed Burnette Third Edition.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
1 Mobile Computing Monetizing An App Copyright 2014 by Janson Industries.
Hello world Follow steps under the sections “Create an AVD” and “Create a New Android Project” at
Chapter 2: Simplify! The Android User Interface
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Chapter 5 Creating User Interfaces GOALS and OBJECTIVES Begin our application by creating our user interface. More than one way to create a user interface.
ANDROID – INTERFACE AND LAYOUT L. Grewe. Interfaces: Two Alternatives Code or XML  You have two ways you can create the interface(s) of your Application.
Homescreen Widgets Demystified Pearl AndroidTO // Oct 26, 2010.
1 Announcements Homework #2 due Feb 7 at 1:30pm Submit the entire Eclipse project in Blackboard Please fill out the when2meets when your Project Manager.
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.
Android Boot Camp for Developers Using Java, 3E
COMP 365 Android Development.  Every android application has a manifest file called AndroidManifest.xml  Found in the Project folder  Contains critical.
User Interfaces: Part 1 (View Groups and Layouts).
Application Development for mobile Devices
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 2: Simplify! The Android User Interface.
Creating an Example Android App in Android Studio Activity lifecycle & UI Resources.
Themes and Menus: The Sudoku Example Content taken from book: “Hello, Android” by Ed Burnette Third Edition.
Themes and Menus: The Sudoku Example Content taken from book: “Hello, Android” by Ed Burnette Third Edition.
First Venture into the Android World Chapter 1 Part 2.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Video Games list lab 6  At the end of this lab you will be expected to know:  What Views, View Groups, Layouts, and Widgets are and how they relate to.
ANDROID – A FIRST PROGRAM L. Grewe Using AndroidStudio –basic Android  Lets do a “Hello World Project”  Start up AndroidStudio (assume you have installed.
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.
Copyright© Jeffrey Jongko, Ateneo de Manila University Deconstructing HelloWorld.
© 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.
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.
© 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.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
The Ingredients of Android Applications. A simple application in a process In a classical programming environment, the OS would load the program code.
Java for android Development Nasrullah Khan. Using instanceof in Android Development the classes such as Button, TextView, and CheckBox, which represent.
INTRODUCTION TO ANDROID. Slide 2 Introduction I take a top-down approach to describing an application’s anatomy.
Introduction to Android Programming
Chapter 2: Simplify! The Android User Interface
Android Application -Architecture.
Mobile Applications (Android Programming)
Android Application Development 1 6 May 2018
Android – Event Handling
MAD.
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Politeknik Elektronika Negeri Surabaya
Mobile Application Development BSCS-7 Lecture # 13
Presentation transcript:

Introducing the Sudoku Example Content taken from book: “Hello, Android” by Ed Burnette Third Edition

Review of key concepts An activity is a user interface screen. Applications can define one or more activities to handle different phases of the program. An intent is a mechanism for describing a specific action, such as “pick a photo,” “phone home,”

More key concepts A service is a task that runs in the background without the user’s direct interaction. A content provider is a set of data wrapped up in a custom API to read and write it. A resource is a localized text string, bitmap, or other small piece of noncode information that your program needs.

Safe and Secure Every application runs in its own Linux process. The hardware forbids one process from accessing another process’s Access to certain critical operations is restricted, and you must specifically ask for permission to use them in a file named Android-Manifest.xml

Most common permissions • INTERNET: Access the Internet. • READ_CONTACTS: Read (but don’t write) the user’s contacts data. • WRITE_CONTACTS: Write (but don’t read) the user’s contacts data. • RECEIVE_SMS: Monitor incoming SMS (text) messages. • ACCESS_COARSE_LOCATION: Use a coarse location provider such as cell towers or wifi. • ACCESS_FINE_LOCATION: Use a more accurate location provider such as GPS.

Example <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.app.myapp" > <uses-permission android:name="android.permission.RECEIVE_SMS" /> </manifest>

Sudoku Game You have a grid of eighty-one tiles (nine across and nine down), and you try to fill them in with numbers so that each column, each row, and each of the three-by-three boxes contains the numbers 1 through 9 only once. When the game starts, some of the numbers (the givens) are already filled in. All the player has to do is supply the rest. A true Sudoku puzzle has only one unique solution.

The Sudoku example program

Designing by Declaration User interfaces can be designed using one of two methods: procedural and declarative. Procedural simply means in code. Declarative design, on the other hand, does not involve any code.

Creating the Opening Screen

First Activity When you create the Sudoku project, the Android plug-in makes a single activity for you in Sudoku.java The call to setContentView( ) fills in the contents of the activity’s screen with an Android view widget.

First Activity: declarative design R.layout.main is a resource identifier that refers to the main.xml file in the res/layout directory main.xml declares the user interface in XML, so that’s the file we need to modify.

Initial resources in the Sudoku project

Linear Layout <LinearLayout </LinearLayout> xmlns:android=http://schemas.android.com/apk/res/android android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- ... --> </LinearLayout>

Some parameters in layouts xmlns:android="http://schemas.android.com/apk/res/android" Defines the XML namespace for Android Inside the <LinearLayout> tag you’ll find one child widget: <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" />

Modified main.xml file The @string/resid syntax refers to strings in the res/values/strings.xml file @+id/about_button defines the ID for the About button

Modified strings.xml file

Modifying the interface Let’s make the title text larger and centered, make the buttons smaller, and use a different background color.

Color Definition the color definition, which you should put in res/values/colors.xml <?xml version="1.0" encoding="utf-8"?> <resources> <color name="background">#3500ffff</color> </resources>

New layout

Using Alternate Resources Let’s see what happens when we switch the emulator to landscape mode by typing Ctrl F11 (in windows)

Different layout for landscape mode Create a file called res/layout-land/main.xml (note the -land suffix)

Implementing an About Box When the user selects the About button, meaning that either they touch it (if they have a touch screen) or they navigate to it with the D-pad (directional pad) or trackball and press the selection button, we want to pop up a window with some information about Sudoku. After scrolling through the text, the user can press the Back button to dismiss the window.

Possible solutions Define a new Activity, and start it. Use the AlertDialog class, and show it. Subclass Android’s Dialog class, and show that.

Defining new activity res/layout/about.xml add strings for the title of the About dialog box and the text it contains to res/values/strings.xml

Formatting strings Note how a string resource can contain simple HTML formatting and can span multiple lines. The backslash character (\) in about_text prevents an extra blank from appearing before the first word.

About activity The About activity should be defined in About.java. All it needs to do is override onCreate( ) and call setContentView( ). To create a new class in Eclipse, use File > New > Class. Specify the following:

About.java Edit the class so it looks like this:

About button in the Sudoku class In the onCreate( ) method, add code to call findViewById( ) to look up an Android view given its resource ID, and add code to call setOnClickListener() to tell Android which object to tickle when the user touches or clicks the view

setOnClickListener( ) method The setOnClickListener( ) method needs to be passed an object that implements the OnClickListener Java interface. OnClickListener has one method in it called onClick( )

Starting activities To start an activity in Android, we first need to create an instance of the Intent class. There are two kinds of intents: public (named) intents that are registered with the system and can be called from any application and private (anonymous)

Activities and the Manifest Every activity needs to be declared in AndroidManifest.xml <activity android:name=".About" android:label="@string/about_title" > </activity>

Clicking on the About button