Android Lecture6
Android Lecture6
Lecture 6
9/21/2011
SeekBar
SeekBar (slider) allow
selection of integer
values using a natural
interface
Constraints:
Min: 0
Max: settable
Changes by: 1
Starting point for knob
can be set
Senses initiation of
touch ,ending of touch,
and movement
SeekBar
SeekBar
Strings in XML
It is possible to provide mappings between
names and strings for your app in XML
Referencing name will replace with actual string
Allows for:
Single find-and-replace of Strings
Simple customization
Internationalization
<tag attribute=value>content</tag>
Essentially equivalent to
String app_name = StringExamples;
Strings in XML
To use in other XML files:
@ refers
to a resource definition
(already saw with ids)
Now:
Multiple Activities
So far, projects limited to one Activity
Next step:
Intra-application communication
Having multiple activities within own application
Inter-application communication
Exploiting capabilities of other interactions
Multiple Activities: Code By Example
First goal:
Press button in one Activity
Leads to opening of a second Activity
Multiple Activities
All Activities within an application need to be
specified in application AndroidManifest.xml
Only one is listed as the main launch Activity
First Activity
(launched)
Second Activity
Intents
Fundamental Android intra- and inter-
application communication
An abstract description of an activity to be
performed
Can be:
Directed to a specific component to be
handled/performed
Broadcast on the device, triggering a response and
handling from an appropriate component
Intents
Simplest intents are used to just trigger a specific known
other Activity:
Intent parameters:
current context (current Activity)
target Activity
Intents
Intent intent = new Intent(MyActivity.this,
MyOtherActivity.class);
startActivity(intent);
First Activity
Second Activity
Two Activity Example: Two Activities
Second Activity
First Activity