Ch1 PTUDTT
Ch1 PTUDTT
Ch1 PTUDTT
Introduction
1.1.1 Smartphones
1.8.1 The
AndroidManifest.xml File:
App Icon and Device
Orientation
Chapter Summary
1.1.1 Smartphones
A smartphone is an intelligent cellular phone, or a
cellular phone with a computer inside, as well as
some extra hardware. Thus, programmers can
write application software for them; such
application software is called an app. A
smartphone has the typical components of a
regular computer: a CPU, memory, a storage
device, an operating system, and other devices,
such as a camera, an accelerometer, or a GPS.
▸ Android Studio
<tagName attribute1=”value1”
Element Content
</tagName>
Android</app>
<tagName attribute1=”value1”
<website name=”twitter”/>
name=”stringName”>valueOfString</string>
<item name=”styleAttribute”>valueOfItem</item>
<color name=”colorName”>valueOfColor</color>
R.className.constantName
Method Description
Method Description
';' expected
defined in strings.xml.
Scaling 2 3 4 6 8
ratio
Dots per 160 dpi 240 320 480 dpi 640 dpi
inch dpi dpi
android:icon=”@mipmap/hi”
android:screenOrientation=”portrait”
</b>Hello<b>
<c digit=”6”></c>
<d>He there</e>
<f letter='Z”/>
<1 digit=”8”>one</1>
<h><i name=”Chris”></i></h>
<j><k name=”Jane”></j>
<l><m name=”Mary”></l></m>
string
name
abc
Hello
<string name=”abc”>Hello</string>
string
name
abc
Hello
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/hi” />
@string/hi
hi
defined in strings.xml
android:text
android.app
android.Activity
android.support.v7.app
false
Fill in the Code
9. Inside the XML snippet next activity_main.xml,
add a line of XML so that the text displayed in
the text field is the value of the string book
(assume that the string book has been
defined in strings.xml)
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
/>
savedInstanceState ){
super.onCreate(savedInstanceState);
}
Write an App
11. Write an app that displays ”I like Android”
12. Write an app that only runs in horizontal
orientation. It displays “This is fun!” on the top
left corner of the screen with no margin either
from the top or the left.