• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
viWave Study Group - Introduction to Google Android Development - Chapter 23 ~ Chapter 29

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



My study group slide in 2009 for Google Android Development, describing the following topics: ...

My study group slide in 2009 for Google Android Development, describing the following topics:

Designing the Obvious,
Resources and Internationalization,



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • User might not need to see the features he/she never used in the application, so gasolin only implement aBMI for metric unit.

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

  • viWave Study GroupIntroduction 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 andInternationalization
  • ResourcesAll 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>.pngWhat if we want to have customizedresources for different situations?
  • ResourcesResources can be used for different or specifiedsituations by setting different qualifiers in foldername: 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
  • LocalizationDefault: res/values/string.xmlIf 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 LocaleChange by UI:Menu -> Settings -> Locale & Text -> Select LocaleChange 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 LocalesResources res = getResources();Configuration config = res.getConfiguration();if (config.locale == Locale.TRADITIONAL_CHINESE) { // do something related to Traditional Chinese;}
  • Screen Layout and OrientationOrientation Navigation Portrait: port notouch Landscape: land dpad Square: square trackball wheelTouch Screen Type notouch Resolution finger 320x240 (QVGA) stylus 320x480 (HVGA) 400x800Text Input 400x854 nokeys qwerty 12key (numbers)
  • Screen Layout and OrientationSample: T-Mobile G1 Normal: port-finger-trackball-320x480 Slide out the keyboard: land-finger-qwerty-trackball-320x480When screen orientation is changed, activity will be re-createdbecause device configuration is changed. Solution: Use SharedPreferences to keep settings in onPause() / onStop().
  • Screen Layout and OrientationHow 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.
  • AdapterAct as an bridge between AdapterView and the data for theview.Provides access to different types of data via single interfaceto the view.Types ArrayAdapter SimpleAdapter (read array from XML file) CursorAdapter (read array from content provider)
  • ArrayAdapterHow to Define String Array?By codestatic final String[] strArray = new String[] { “item1”, “item2”, …};ArrayAdapter<CharSequence> adapter_string = newArrayAdapter<String>(this, android.R.layout.simple_list_item,strArray);
  • ArrayAdapter How to define string array?By XMLres/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);
  • SpinnerSpinner 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.
  • SpinnerHow 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 KnowAll applications must be signed.We can use self-signed certificates to sign applications.Must sign application with private key before releasing theapplication.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 tooptimize the apk file.
  • Signing StrategySign all applications with the same certification, throughoutthe 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 ofthe certification must be later than October 22, 2033.
  • Signing the ApplicationExport the unsigned We can do this by usingAPK. the Export Wizard in Eclipse!Obtain the signing key. We can also do this bySigning the key. exporting signed APK in Package Explorer inVerifying the key. Eclipse!Install the ApplicationPublish 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!