COMP5047 Week 4 Lecture handouts (Rainer Wasinger)
description
Transcript of COMP5047 Week 4 Lecture handouts (Rainer Wasinger)
![Page 1: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/1.jpg)
COMP 5047 Pervasive Computing: Week 4: Smartphones & the Android OS
Dr.-Ing. Rainer Wasinger
School of Information Technologies
![Page 2: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/2.jpg)
Background:
2
• A good book: Multimodal Interaction with Mobile
Devices
![Page 3: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/3.jpg)
Background:
• Mobile Device Projects at the DFKI
3
![Page 4: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/4.jpg)
Background:
• Smart Services CRC
4
![Page 5: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/5.jpg)
Background:
• Multi-Channel Content Repurposing & Mobile
Personalisation
5
![Page 6: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/6.jpg)
Part 1: Phone Statistics
6
![Page 7: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/7.jpg)
Statistics: Mobile phone growth
• 4.1 billion mobile subscriptions in the world, representing a
global penetration rate of 61.1%
• 1.27 billion fixed line subscribers, representing a global
penetration rate of 18.9%.
7
Source: International Telecommunication Union’s ICT Development Index
(IDI) for 2008.
![Page 8: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/8.jpg)
Statistics: Top 5 handsets in the US, Q1 2009
• 1Q2009 US consumer sales of smartphone
handsets:
• 1. RIM BlackBerry Curve (all 83XX models).
• 2. Apple iPhone 3G (all models).
• 3. RIM BlackBerry Storm
• 4. RIM BlackBerry Pearl (all models, except flip).
• 5. T-Mobile G1.
Source: “RIM Unseats Apple in The NPD Group‟s Latest
Smartphone Ranking”, Port Washington, New York, May 4,
2009.
8
![Page 9: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/9.jpg)
Statistics: Mobile terminal, smartphone, and operating
system market share
9
Worldwide mobile terminal
sales to end users in 1Q2009
(source: Gartner).
Worldwide smartphone
sales to end users in 1Q2009
(source: Gartner).
Smartphone OS market
share in 4Q2008
(source: Gartner).
![Page 10: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/10.jpg)
Statistics: Specific to Android
Android: Seven Months, By The Numbers
• 10 carriers in 12 countries
• 4,900+ applications in the Android Market
• 40+ app downloads per user
• #2 in U.S. mobile web browsing
• 3 platform releases, and counting…Source: Google I/O Conference 2009, 28.May.2009.
10
![Page 11: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/11.jpg)
Statistics Specific to the G1 Handset
• Approximately 1.5 million G1s were ordered since October 2008
• Customers purchasing a G1 from T-Mobile were trading up from a
basic handset 50% of the time.
• 50% of the G1 customers access Wi-Fi daily.
• 80% of G1 owners browse the web at least once a day
• 80% of the people owning a G1 download an Android application at
least once a week
• The vast majority of T-Mobile G1 owners use Facebook and YouTube
at least once a week
• The average G1 T-Mobile customers consumers 50 times the data vs.
the average voice-centric phone user.
Source: Robert Dotson, CEO of T-Mobile USA, 04.April 2009
11
![Page 12: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/12.jpg)
Statistics: Android Forecast for 2009
• “We forecast global Android smartphone
shipments to grow an impressive 900% annually
during 2009…Android is expanding from a low
base and it is consequently outgrowing the iPhone
OS from Apple, which we estimate will grow at a
relatively lower 79% annually in 2009.”
Source: Tom Kang, Senior Analyst at Strategy
Analytics, 12.May.2009.
12
![Page 13: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/13.jpg)
Android Smartphone Device Characteristics
13
HTC Dream HTC Magic
![Page 14: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/14.jpg)
Android Smartphone Device CharacteristicsMobile Device HTC Dream HTC Magic
Release date Oct 2008 May 2009
OS Android Android
Display 3.2”, 320x480 (HVGA), capacitive “”
Dimensions 117.7mm x 55.7mm x 17.1mm 113mm x 55m x 13.65mm
Weight 158g 118.5g
Processor Qualcomm MSM7201A 528MHz “”
Memory 256MB ROM, 192MB RAM 512MB ROM, 192MB RAM
Battery 1150mAh 1340mAh
Network HSDPA/WCDMA (1700, 2100MHz),
Quad-band GSM/GPRS/EDGE (850,
900, 1800, 1900MHz)
HSDPA/WCDMA (900, 2100MHz),
Quad-band GSM/GPRS/EDGE
(850, 900, 1800, 1900MHz)
Camera 3.2MP with auto focus “”
WiFi WiFi 802.11b/g “”
Bluetooth Bluetooth 2.0 with EDR “”
Sensors GPS, digital compass, accelerometer “”
14
![Page 15: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/15.jpg)
Other Smartphones on the Market
15
Blackberry Storm
HTC Touch Pro 2
HTC Hero
iPhone 3GS
Palm Pre
![Page 16: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/16.jpg)
Competing mobile Operating Systems
• Competing mobile Operating Systems include:
• Windows Mobile OS:
• Closed source.
• Apple iPhone OS:
• Closed source.
• BlackBerry OS:
• Closed source.
• Palm webOS (released June.2009).
• Closed-source, with open-source components.
• Nokia Symbian OS.
• Currently closed-source, though the recently established Symbian
Foundation are working on publishing the Symbian platform (slated for
mid 2010) royalty-free under the open source Eclipse Public License
(EPL).
16
![Page 17: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/17.jpg)
Part 2: Smartphone Evolution
17
![Page 18: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/18.jpg)
History: 1st Mobile Phone
• 1st mobile phone: The Motorola DynaTac,
released in 1978, providing telephony services for
people on the go.
18
![Page 19: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/19.jpg)
History: 1st PDA
• 1st PDA: The Apple/Sharp Newton MessagePad, released
in 1993, providing personal information management
services, like a personal organiser and an address book.
19
• By 2002, and after 10 years
growth, PDA shipments
began experiencing a decline
(also due to a world-wide
economic down-turn, and the
smart phone emerged.
![Page 20: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/20.jpg)
History: The Universal Mobile Terminal
• The UMT refers to the fictional digital convergence device
of the future, and is based on the convergence of the 3C‟s,
i.e. computing, communication, and consumer electronics.
– Convergence of computing and communication has
already taken place, resulting in the smart phone.
– The 3rd C, consumer electronics, refers to electronic
consumer devices. It is still anyone‟s guess as to how
consumer electronics will influence the design of the
future UMT.
• E.g.: Mobile entertainment devices such as music players (e.g.
Apple iPod, Sony Walkman), video players, handheld
televisions, and gaming devices (e.g. the Nokia N-Gage).
20
![Page 21: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/21.jpg)
History: Limitations of convergence
• In many cases, simple and easy-to-use single-function devices are
preferred by users over multifunctional combos. Design tradeoffs
arising as a result of device convergence are inevitable.
• Some mobile device types that are resisting convergence (and even
newly emerging):
– Mobile Internet Devices (MIDs) like the Apple iTouch
– E-books like the Amazon Kindle
– In-car navigation consoles like the Tom Tom Go
– Gaming consoles like the Nintendo DS
– So-called „social phones‟ like the INQ1/Hutchison 3 Facebook phone.
• These devices are all hoping to have found niches in the market,
based on device convergence design tradeoffs.
21
![Page 22: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/22.jpg)
Definition of a Smartphone
• Smartphone: A mobile device that exhibits converged PDA and phone
functionality.
– Typically support, in addition to voice communication, PIM (e.g.
applications like a calendar, address book, clock, and notepad).
– Modern smartphones also typically provide the ability to:
• send/receive emails and instant messages,
• access the Internet and related web-based services, including but not
limited to social networking sites like Facebook, MySpace, and Twitter.
• install rich 3rd party applications that have access to much of a
system‟s underlying resources.
• Note however that there is no industry agreement as to what precisely
constitutes a „smart‟ phone.
22
![Page 23: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/23.jpg)
Part 3: Android OS
23
![Page 24: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/24.jpg)
Android OS
24
• Android OS:
– An open source mobile platform based on the Linux operating
system.
– Applications are developed using the Java programming language.
– Applications run on Dalvik, a custom virtual machine designed for
embedded use, which runs on top of a Linux kernel.
– Although Android reuses the Java language syntax, it does not
provide the full-class libraries and APIs bundled with Java SE or
Java ME, using the Harmony Java implementation instead (due to
Apache‟s license allowing for closed source derived works).
– The latest Android OS release is 1.5, released on 30.April.2009.
![Page 25: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/25.jpg)
Android OS
• Android, License:
– Most of the Android code has been released under the Apache License.
• Although Android is an open-source product, some development has been
continuing in a private development branch.
– Apache License allows vendors to add proprietary extensions without
submitting those back to the open source community.
• Android, Origins:
– Developed originally by Google, and later/now by the Open
Handset Alliance.
– Announced on 05.November.2007, together with the founding of
the Open Handset Alliance (OHA).
• The OHA:
– A consortium of 50 firms (hardware, software, and telecoms)
devoted to advancing open standards for mobile devices
• Companies include: Google, HTC, Intel, Motorola, Qualcomm, Texas
Instruments, Samsung, LG, T-Mobile.
25
![Page 26: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/26.jpg)
The Android Stack
• The Android platform is a software stack for mobile devices
including:
– An operating
system
– Middleware
– Key applications
26
![Page 27: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/27.jpg)
Android OS Features
27
![Page 28: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/28.jpg)
Android Development
• Required software for developing for the Android
platform (for Windows XP/Vista, Mac OS X 10.4.8
and later, and Linux):
– Android v1.5 SDK: android-sdk-windows-1.5_r2.zip [172MB]
• http://developer.android.com/
– Eclipse v3.4.2 (Ganymede): eclipse-jee-ganymede-SR2-
win32.zip [167MB]
• http://www.eclipse.org/downloads/
– Android Development Tools (ADT) v0.9 plug-in for Eclipse
• http://developer.android.com/sdk/1.5_r2/installing.html
28
![Page 30: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/30.jpg)
Android Developer Resources
30
• Dev Guide:
![Page 31: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/31.jpg)
Android Developer Resources
• Reference:
31
![Page 32: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/32.jpg)
Some quick questions
• Who hasn‟t used the Eclipse IDE before?
• Who isn‟t familiar with the Java programming
language?
• Who isn‟t familiar with XML?
32
![Page 33: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/33.jpg)
Part 4: Anatomy of an Android Application
• Android applications don‟t have a single entry point for
everything in the application (i.e. not main() function).
Instead, they have essential components that the system
can instantiate and run as needed.
– This is partly to make the applications more crash-resistant.
• There are 4 types of components:
– Activities
– Services
– Broadcast receivers
– Content providers.
• We will focus on the Activity component.
33
![Page 34: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/34.jpg)
Android Components
• Services:
• Services run in the background, often without a visual user
interface.
• E.g. a service might play background music, or might fetch data
over the network.
• Broadcast receivers:
• These are components that do nothing but receive and react to
broadcast announcements.
• E.g. an announcement might be that the time zone has changed,
that the battery is low, or that a picture has been taken.
• Content providers:
• Make a specific set of the application‟s data available to other
applications. Such data can for example be stored in the file
system, in an SQLite database.
34
![Page 35: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/35.jpg)
Android Components (cont.)
• Activities:
– Activities represent the building block of the user
interface.
– An activity presents a visual user interface for one
focused endeavour that the user can undertake.
– E.g. an activity might present a list of contacts to send
messages to, while other activities might deal with the
writing of messages, the viewing of old messages, and
the changing of settings.
– Each activity is independent of the others, and each one
is implemented as a subclass of the Activity base class.
35
![Page 36: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/36.jpg)
Tasks and the Activity Stack
• A „task‟ is what the user experiences as an „application‟. It is a
group of related activities, arranged in a stack.
• The root activity in the stack is the one that began the task, e.g.
the activity the user selected in the application launcher.
• One activity can start another activity. When this happens, the
new activity is pushed onto the stack and it becomes the running
activity.
• When the user presses the back key, the current activity is
popped from the stack, and the previous one resumes as the
running activity.
• Starting a task: An activity is set up as the entry point for a task
by giving it an intent filter with “android.intent.action.MAIN” as
the specified action and “android.intent.category.LAUNCHER”
as the specified category.
36
![Page 37: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/37.jpg)
The Lifecycle of an Activity
• Four essential states:
– Active: i.e. the Activity is running and
is in the foreground of the screen.
– Paused: i.e. the Activity is running,
and is visible, but a notification (or
other) is overlaying part of the screen.
The user may not be able to interact
with the Activity during this time.
– Stopped: The Activity is running, but it
is hidden by other activities that have
been launched.
– Dead: When for e.g. an Activity is
terminated, perhaps due to lack of
available memory.
37
![Page 38: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/38.jpg)
The Lifecycle of an Activity (cont.)
• onCreate() and onDestroy():
– The entire lifetime of an Activity happens between the
first call to onCreate() through to a single final call to
onDestroy().
– An Activity does all of its initial setup in onCreate() and
releases all remaining resources in onDestroy().
• onStart(), onRestart(), and onStop():
• The visible lifetime of an Activity happens between a call to
onStart() until a corresponding call to onStop().
• onStart() is called when an activity is first launched.
• onRestart() is called when an activity is brought back to the
foreground after having been hidden.
• onStop is called when the activity is about to be stopped.
38
![Page 39: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/39.jpg)
The AndroidManifest.xml File
• Before Android can start an application, it must learn that
the component exists. Applications declare their
components in a manifest file that is bundled into the
Android package, i.e. the .apk file that holds the
application‟s code, files, and resources.
• The manifest is a structured XML file and is always named
AndroidManifest.xml for all applications.
• In addition to declaring the application‟s components, it
also identifys any permissions the application expects to be
granted.
39
![Page 40: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/40.jpg)
Intents
• While one Activity will be special in that it is used
to start an application, the other activities also
need to be reached. This is done through the use
of asynchronous messages called Intents.
• An Intent is an object that holds the content of a
message. Intents can be very specific (e.g.
requesting a specific Activity to be launched) or
can be more generic (e.g. when multiple criteria is
needed for selecting an Activity to launch).\
• Activities are launched by passing an Intent object
to the Context.startActivity() method.
40
![Page 41: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/41.jpg)
Intent Filters
• An Intent object can explicitly name a target component. If
it does, Android finds that component and activates it. If a
target is not explicitly named, Android must locate the best
component to respond to the intent.
• A component can have any number of intent filters, each
one declaring a different set of capabilities.
• If a component doesn‟t have any filters, it can be activated
only by intents that explicitly name the component as the
target.
41
![Page 42: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/42.jpg)
Designing the User Interface
• User interfaces are built using View and ViewGroup objects.
• The View class serves as the base for subclasses called “widgets”,
which offer fully implemented UI objects, like text fields and buttons.
• The ViewGroup class serves as the base for subclasses called
“layouts”, which offer different kinds of layout architecture, like linear,
tabular, and relative.
• To attach a view hierarchy tree to the
screen for rendering, an Activity must
call the setContentView() method
and pass a reference to the root node
object.
42
View Hierarchy
![Page 43: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/43.jpg)
Designing the User Interface (cont.)
• The most common way to define a layout and express the
view hierarchy is with an XML layout file.
• Each element in XML is either a View or ViewGroup object.
• View objects are the leaves in the tree.
• ViewGroup objects are the branches in the tree.
• Combining different Views in a nested XML structure is the
basis for GUI creation.
43
![Page 44: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/44.jpg)
Part 5: The Code
44
![Page 45: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/45.jpg)
Notepadv3 in the Eclipse IDE
45
![Page 46: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/46.jpg)
Notepadv3 Example – The Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.demo.notepad3">
<application android:icon="@drawable/icon">
<activity android:name=".Notepadv3"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".NoteEdit"/>
</application>
</manifest>
46
![Page 47: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/47.jpg)
Notepadv3 Example – An Activity Class
public class Notepadv3 extends ListActivity {
...
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notes_list);
mDbHelper = new NotesDbAdapter(this);
mDbHelper.open();
fillData();
registerForContextMenu(getListView());
} //onCreate
...
47
![Page 48: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/48.jpg)
Notepadv3 Example – An Intent
@Override
protected void onListItemClick(ListView l, View v, int position,
long id) {
super.onListItemClick(l, v, position, id);
Intent i = new Intent(this, NoteEdit.class);
i.putExtra(NotesDbAdapter.KEY_ROWID, id);
startActivityForResult(i, ACTIVITY_EDIT);
}
48
![Page 49: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/49.jpg)
Notepadv3 Example – notes_list.xml GUI
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView android:id="@+id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No Notes!"/>
</LinearLayout>
49
![Page 50: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/50.jpg)
Part 6: Eclipse – Using the IDE
50
![Page 51: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/51.jpg)
Using the Eclipse IDE
• Editing code
51
![Page 52: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/52.jpg)
Using the Eclipse IDE
52
• Designing a GUI
![Page 53: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/53.jpg)
Using the Eclipse IDE
53
• Using the Debugger
![Page 54: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/54.jpg)
Using the Eclipse IDE
54
• LogCat
![Page 55: COMP5047 Week 4 Lecture handouts (Rainer Wasinger)](https://reader034.fdocuments.net/reader034/viewer/2022051323/54809e4f5806b501118b457e/html5/thumbnails/55.jpg)
COMP5047 Property App Week 5 Lab Task
55
• Screen shots