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 .
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
Content taken from book:
“Hello, Android” by Ed Burnette
• 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.
<uses-permission android:name="android.permission.RECEIVE_SMS" />
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.
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.
<!-- ... -->
The @string/resid syntax refers to strings in the res/values/strings.xml file
@+id/about_buttondefines the ID for the About button
<?xml version="1.0" encoding="utf-8"?>
Let’s see what happens when we switch the emulator to landscape mode by typing
Create a file called res/layout-land/main.xml (note the -land suffix)
add strings for the title of the About dialog box and the text it
contains to res/values/strings.xml
Edit the class so it looks like this:
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