SlideShare a Scribd company logo
viWave Study Group
Introduction to Google Android Development
              Chap. 23~Chap.29
                     Ted Chien
                       #7151
               ted.chien@viwav.com
               Supervisory Engineer
                  viWave Co. Ltd.
Agenda
• Designing the Obvious

• Resource and Internationalization

• Orientation

• Adapter

• Spinner

• Signing Application Key

• Publish to Android Market
Designing the Obvious
    Make It Simple and Easy-to-Use
 Only provides features that users need.

 Match user behaviors.

 Help users to get advanced.

 Easy to recover from mistakes.

 Consistence UI elements.
Resources and
Internationalization
Resources
All resource files are in /res folder.
Default folders for different resources:
     Values: res/values/<filename>.xml
     Layout: res/layout/<filename>.xml
     Drawables: res/drawable/<filename>.png

What if we want to have customized
resources for different situations?
Resources
Resources can be used for different or specified
situations by setting different qualifiers in folder
name:
  Mobile Country Code and Mobile Network Code.
  Language Code and Region Code.
  Screen types, dimensions, densities and orientations.
  Touch screen types.
  Keyboard states and types.
  Navigation control types.
  SDK version.


Possible resource folder name:
  res/layout-zh-rTW-large-port-mdpi-finger-qwerty-dpad-
  480x320/main.xml
Localization
Default: res/values/string.xml

If we need other languages:
  res/values-<language-code>-r<region-code>/string.xml
  Language code (ISO-639): en, ja, zh,...
  Region code (ISO-3166): US, UK, CN, TW,....

Example:
  Chinese (Taiwan): res/values-zh-rTW/string.xml
  Chinese (PRC): res/values-zh-rCN/string.xml
Change UI Locale
Change by UI:
Menu -> Settings -> Locale & Text -> Select Locale
Change by Code:
Resources res = getResources();

Configuration config = res.getConfiguration();

config.locale = Locale.TRADITIONAL_CHINESE; // or Locale.TAIWAN;

DisplayMetrics dm = res.getDisplayMetrics();

res.updateConfiguration(config, dm);
Writing code for different
                Locales
Resources res = getResources();

Configuration config = res.getConfiguration();

if (config.locale == Locale.TRADITIONAL_CHINESE) {

       // do something related to Traditional Chinese;

}
Screen Layout and Orientation
Orientation         Navigation
  Portrait: port      notouch
  Landscape: land     dpad
  Square: square      trackball
                      wheel
Touch Screen Type
  notouch           Resolution
  finger              320x240 (QVGA)
  stylus              320x480 (HVGA)
                      400x800
Text Input            400x854
  nokeys
  qwerty
  12key (numbers)
Screen Layout and Orientation

Sample: T-Mobile G1
  Normal: port-finger-trackball-320x480
  Slide out the keyboard: land-finger-qwerty-trackball-320x480

When screen orientation is changed, activity will be re-created
because device configuration is changed.
  Solution:
      Use SharedPreferences to keep settings in onPause() / onStop().
Screen Layout and Orientation

How to fix the screen orientation?
  AndroidManifest.xml
     Add android:screenOrientation value to <activity> tag.
     Values: portrait, landscape, sensor.
  In code:
     Import android.content.pm.ActivityInfo;
     Call setRequestedOrientation(
        ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE )
     or
        setRequestedOrientation(
               ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) in
     activity.
Adapter
Act as an bridge between AdapterView and the data for the
view.

Provides access to different types of data via single interface
to the view.

Types
   ArrayAdapter
   SimpleAdapter (read array from XML file)
   CursorAdapter (read array from content provider)
ArrayAdapter
How to Define String Array?
By code

static final String[] strArray = new String[] {

     “item1”,

     “item2”,

     …

};
ArrayAdapter<CharSequence> adapter_string = new
ArrayAdapter<String>(this, android.R.layout.simple_list_item,
strArray);
ArrayAdapter
  How to define string array?
By XML
res/values/string.xml
   <resource>
     <string-array name=“strArray”>
              <item>1st</item>
              ….
    </string-array>
  </resource>
Code:
   ArrayAdapter<CharSequence> adapter_string =
      ArrayAdapter.createFromResource( this, R.array.strArray,
      andorid.R.layout.simple_list_item);
Spinner
Spinner is like pull-down menu.

How to add a Spinner?
   Layout XML
      Add Spinner control.
      Set android:drawSelectorOnTop=“true”.
      Set android:prompt with title string id.
   Code
      Call getViewbyId() to get the view and cast to Spinner.
      Create ArrayAdapter instance to prepare the data.
      Call ArrayAdapter.setDropDownViewResource() to make the resource
      of the Drop-Down view.
      Set the data adapter to the Spinner control.
Spinner
How to select an item in Spinner?
    private Spinner.OnItemSelectedListener select = new
    Spinner.OnItemSelectedListener() {
       public void onItemSelected(AdapterView parent, View v, int position, long id)
    {
                   // something selected.
       }
       public void onNothingSelected(AdapterView parent) {
                   // nothing selected.
       }
    }
Call setOnItemSelectedListener(select) to set the listener to the Spinner control so it
    can listen to user behaviors.
After selection, use Spinner.getSelectedItemPosition() to get the selected count.
Select item by code: Spinner.setSelection().

Sample: API Demo - Spinner
Signing Application Key
Things to Know
All applications must be signed.

We can use self-signed certificates to sign applications.

Must sign application with private key before releasing the
application.

System will check certificate’s expiration date at install time.

Signing tool: Keytool and Jarsigner, all in JDK.

After application is signed, we can use zipalign tool to
optimize the apk file.
Signing Strategy
Sign all applications with the same certification, throughout
the lifespan of the applications (25 years suggested).

Reasons:
  Users can upgrade application seamlessly.
      New certification would require new package name, system would
      consider your AP as an new one.
  APs can run in the same process, and will be treated as single AP.
  APs can share code/data with each other.

If AP will be released to Android Market, the valid date of
the certification must be later than October 22, 2033.
Signing the Application
Export the unsigned       We can do this by using
APK.                      the Export Wizard in
                          Eclipse!
Obtain the signing key.
                          We can also do this by
Signing the key.          exporting signed APK in
                          Package Explorer in
Verifying the key.
                          Eclipse!
Install the Application

Publish the Application
Checking List in
           AndroidManifest.xml
• Version defined correctly?
   – android:versionCode
   – android:versionName

• Activities defined correctly?

• Permissions defined correctly?

• SDK version defined correctly?
   – android:minSDKVersion
   – android:targetSDKVersion (optional)
   – android:maxSDKVersion (optional)
Publish to Android
      Market
Methods to Release
               Applications
• Publish to Android Market.

• Publish to 3rd-Party Market.
  – SlideMe: http://www.slideme.org
  – Camangi Market (for Camangi
    WebStation):http://www.camangimarket.com/
  – FET Smart Market: http://www.smartapp.tw
  – ChinaMobile Mobile Market: http://www.mmarket.com
  – AndAppStore: http://andappstore.com

• Put it on our own website for download.
How Android Market Works?

• Just upload signed Program.apk to Android Market and click
  on Publish, users will see the application to download
  immediately.

• Revenue Sharing:
  – Paid AP Developer: 70%
  – Operators and e-Commerce Providers: 30%

• Users can refund paid application in 24 hours.
How to Register for Android
            Market?
• Registration Fee: USD 25 for lifetime.

• Where to register for Android Market?
  – http://market.android.com/publish

• Must have Google account.

• Must pay the registration fee via Google Checkout.

• Must use international cell phone number.
How to Upload AP to Android
          Market?
• Must upload Release mode and signed APK file.

• Can publish through different locales, countries, operators,
  and categories.
Managing AP on Android
             Market
• We can see how many applications we have published.

• We can also see how many downloads and ratings of our
  applications on Android Market.

• We can view user comments on our applications through 3rd-
  Party website:
  – Cyket: http://www.cyket.com
  – aTrackDog: http://atrackdog.a0soft.com
  – Android Stats: http://androidstats.com/ranking/applications
Q&A
Thank You!

More Related Content

Similar to viWave Study Group - Introduction to Google Android Development - Chapter 23 ~ Chapter 29 (20)

PDF
Android tutorial
Abid Khan
 
PDF
Android Introduction
Daniela Da Cruz
 
PDF
Getting Started with Android - OSSPAC 2009
sullis
 
PPT
Android Training Ahmedabad , Android Course Ahmedabad, Android architecture
NicheTech Com. Solutions Pvt. Ltd.
 
PPT
"Android" mobilių programėlių kūrimo įvadas #2
Tadas Jurelevičius
 
PDF
Introduction to Android - Mobile Portland
sullis
 
PPT
Part 2 android application development 101
Michael Angelo Rivera
 
PPTX
Getting started with android programming
PERKYTORIALS
 
PPT
eyeryeryeryeryeyeyeryeryyerye13872085.ppt
FarhanGhafoor7
 
PDF
Android Bootcamp
ahkjsdcsadc
 
PDF
Android development - the basics, MFF UK, 2012
Tomáš Kypta
 
PDF
Android Development
mclougm4
 
PPT
Android activity, service, and broadcast recievers
Jagdish Gediya
 
PPTX
Android App Development (Basics)
Alberto Rubalcaba Stockman
 
PDF
Android Jump Start
ConFoo
 
PPT
Android - Android Application Configuration
Vibrant Technologies & Computers
 
DOCX
Android Tutorial For Beginners Part-1
Amit Saxena
 
PDF
Android Minnebar
Justin Grammens
 
PDF
Android Design Guidelines 4.0
Brandon Nolte
 
PDF
Android development - the basics, MFF UK, 2014
Tomáš Kypta
 
Android tutorial
Abid Khan
 
Android Introduction
Daniela Da Cruz
 
Getting Started with Android - OSSPAC 2009
sullis
 
Android Training Ahmedabad , Android Course Ahmedabad, Android architecture
NicheTech Com. Solutions Pvt. Ltd.
 
"Android" mobilių programėlių kūrimo įvadas #2
Tadas Jurelevičius
 
Introduction to Android - Mobile Portland
sullis
 
Part 2 android application development 101
Michael Angelo Rivera
 
Getting started with android programming
PERKYTORIALS
 
eyeryeryeryeryeyeyeryeryyerye13872085.ppt
FarhanGhafoor7
 
Android Bootcamp
ahkjsdcsadc
 
Android development - the basics, MFF UK, 2012
Tomáš Kypta
 
Android Development
mclougm4
 
Android activity, service, and broadcast recievers
Jagdish Gediya
 
Android App Development (Basics)
Alberto Rubalcaba Stockman
 
Android Jump Start
ConFoo
 
Android - Android Application Configuration
Vibrant Technologies & Computers
 
Android Tutorial For Beginners Part-1
Amit Saxena
 
Android Minnebar
Justin Grammens
 
Android Design Guidelines 4.0
Brandon Nolte
 
Android development - the basics, MFF UK, 2014
Tomáš Kypta
 

Recently uploaded (20)

PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
July Patch Tuesday
Ivanti
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Python basic programing language for automation
DanialHabibi2
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Ad

viWave Study Group - Introduction to Google Android Development - Chapter 23 ~ Chapter 29

  • 1. viWave Study Group Introduction to Google Android Development Chap. 23~Chap.29 Ted Chien #7151 [email protected] Supervisory Engineer viWave Co. Ltd.
  • 2. Agenda • Designing the Obvious • Resource and Internationalization • Orientation • Adapter • Spinner • Signing Application Key • Publish to Android Market
  • 3. Designing the Obvious Make It Simple and Easy-to-Use  Only provides features that users need.  Match user behaviors.  Help users to get advanced.  Easy to recover from mistakes.  Consistence UI elements.
  • 5. Resources All resource files are in /res folder. Default folders for different resources: Values: res/values/<filename>.xml Layout: res/layout/<filename>.xml Drawables: res/drawable/<filename>.png What if we want to have customized resources for different situations?
  • 6. Resources Resources can be used for different or specified situations by setting different qualifiers in folder name: Mobile Country Code and Mobile Network Code. Language Code and Region Code. Screen types, dimensions, densities and orientations. Touch screen types. Keyboard states and types. Navigation control types. SDK version. Possible resource folder name: res/layout-zh-rTW-large-port-mdpi-finger-qwerty-dpad- 480x320/main.xml
  • 7. Localization Default: res/values/string.xml If we need other languages: res/values-<language-code>-r<region-code>/string.xml Language code (ISO-639): en, ja, zh,... Region code (ISO-3166): US, UK, CN, TW,.... Example: Chinese (Taiwan): res/values-zh-rTW/string.xml Chinese (PRC): res/values-zh-rCN/string.xml
  • 8. Change UI Locale Change by UI: Menu -> Settings -> Locale & Text -> Select Locale Change by Code: Resources res = getResources(); Configuration config = res.getConfiguration(); config.locale = Locale.TRADITIONAL_CHINESE; // or Locale.TAIWAN; DisplayMetrics dm = res.getDisplayMetrics(); res.updateConfiguration(config, dm);
  • 9. Writing code for different Locales Resources res = getResources(); Configuration config = res.getConfiguration(); if (config.locale == Locale.TRADITIONAL_CHINESE) { // do something related to Traditional Chinese; }
  • 10. Screen Layout and Orientation Orientation Navigation Portrait: port notouch Landscape: land dpad Square: square trackball wheel Touch Screen Type notouch Resolution finger 320x240 (QVGA) stylus 320x480 (HVGA) 400x800 Text Input 400x854 nokeys qwerty 12key (numbers)
  • 11. Screen Layout and Orientation Sample: T-Mobile G1 Normal: port-finger-trackball-320x480 Slide out the keyboard: land-finger-qwerty-trackball-320x480 When screen orientation is changed, activity will be re-created because device configuration is changed. Solution: Use SharedPreferences to keep settings in onPause() / onStop().
  • 12. Screen Layout and Orientation How to fix the screen orientation? AndroidManifest.xml Add android:screenOrientation value to <activity> tag. Values: portrait, landscape, sensor. In code: Import android.content.pm.ActivityInfo; Call setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ) or setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) in activity.
  • 13. Adapter Act as an bridge between AdapterView and the data for the view. Provides access to different types of data via single interface to the view. Types ArrayAdapter SimpleAdapter (read array from XML file) CursorAdapter (read array from content provider)
  • 14. ArrayAdapter How to Define String Array? By code static final String[] strArray = new String[] { “item1”, “item2”, … }; ArrayAdapter<CharSequence> adapter_string = new ArrayAdapter<String>(this, android.R.layout.simple_list_item, strArray);
  • 15. ArrayAdapter How to define string array? By XML res/values/string.xml <resource> <string-array name=“strArray”> <item>1st</item> …. </string-array> </resource> Code: ArrayAdapter<CharSequence> adapter_string = ArrayAdapter.createFromResource( this, R.array.strArray, andorid.R.layout.simple_list_item);
  • 16. Spinner Spinner is like pull-down menu. How to add a Spinner? Layout XML Add Spinner control. Set android:drawSelectorOnTop=“true”. Set android:prompt with title string id. Code Call getViewbyId() to get the view and cast to Spinner. Create ArrayAdapter instance to prepare the data. Call ArrayAdapter.setDropDownViewResource() to make the resource of the Drop-Down view. Set the data adapter to the Spinner control.
  • 17. Spinner How to select an item in Spinner? private Spinner.OnItemSelectedListener select = new Spinner.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View v, int position, long id) { // something selected. } public void onNothingSelected(AdapterView parent) { // nothing selected. } } Call setOnItemSelectedListener(select) to set the listener to the Spinner control so it can listen to user behaviors. After selection, use Spinner.getSelectedItemPosition() to get the selected count. Select item by code: Spinner.setSelection(). Sample: API Demo - Spinner
  • 19. Things to Know All applications must be signed. We can use self-signed certificates to sign applications. Must sign application with private key before releasing the application. System will check certificate’s expiration date at install time. Signing tool: Keytool and Jarsigner, all in JDK. After application is signed, we can use zipalign tool to optimize the apk file.
  • 20. Signing Strategy Sign all applications with the same certification, throughout the lifespan of the applications (25 years suggested). Reasons: Users can upgrade application seamlessly. New certification would require new package name, system would consider your AP as an new one. APs can run in the same process, and will be treated as single AP. APs can share code/data with each other. If AP will be released to Android Market, the valid date of the certification must be later than October 22, 2033.
  • 21. Signing the Application Export the unsigned We can do this by using APK. the Export Wizard in Eclipse! Obtain the signing key. We can also do this by Signing the key. exporting signed APK in Package Explorer in Verifying the key. Eclipse! Install the Application Publish the Application
  • 22. Checking List in AndroidManifest.xml • Version defined correctly? – android:versionCode – android:versionName • Activities defined correctly? • Permissions defined correctly? • SDK version defined correctly? – android:minSDKVersion – android:targetSDKVersion (optional) – android:maxSDKVersion (optional)
  • 24. Methods to Release Applications • Publish to Android Market. • Publish to 3rd-Party Market. – SlideMe: http://www.slideme.org – Camangi Market (for Camangi WebStation):http://www.camangimarket.com/ – FET Smart Market: http://www.smartapp.tw – ChinaMobile Mobile Market: http://www.mmarket.com – AndAppStore: http://andappstore.com • Put it on our own website for download.
  • 25. How Android Market Works? • Just upload signed Program.apk to Android Market and click on Publish, users will see the application to download immediately. • Revenue Sharing: – Paid AP Developer: 70% – Operators and e-Commerce Providers: 30% • Users can refund paid application in 24 hours.
  • 26. How to Register for Android Market? • Registration Fee: USD 25 for lifetime. • Where to register for Android Market? – http://market.android.com/publish • Must have Google account. • Must pay the registration fee via Google Checkout. • Must use international cell phone number.
  • 27. How to Upload AP to Android Market? • Must upload Release mode and signed APK file. • Can publish through different locales, countries, operators, and categories.
  • 28. Managing AP on Android Market • We can see how many applications we have published. • We can also see how many downloads and ratings of our applications on Android Market. • We can view user comments on our applications through 3rd- Party website: – Cyket: http://www.cyket.com – aTrackDog: http://atrackdog.a0soft.com – Android Stats: http://androidstats.com/ranking/applications
  • 29. Q&A

Editor's Notes

  • #4: User might not need to see the features he/she never used in the application, so gasolin only implement aBMI for metric unit.