Removing quotes from page.tags values
Change-Id: I9e12079568ef7be8574743a34856ed2839e1e76a
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
page.title=Buttons
|
||||
page.tags="button","input"
|
||||
page.tags=button,input
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/controls/button.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Dialogs
|
||||
page.tags="dialog","alert","popup","toast"
|
||||
page.tags=dialog,alert,popup,toast
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/dialogs.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Grid Lists
|
||||
page.tags="gridview","layout","listview"
|
||||
page.tags=gridview,layout,listview
|
||||
@jd:body
|
||||
|
||||
<img src="{@docRoot}design/media/gridview_overview.png">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Lists
|
||||
page.tags="listview","layout"
|
||||
page.tags=listview,layout
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/layout/listview.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Pickers
|
||||
page.tags="datepicker","timepicker"
|
||||
page.tags=datepicker,timepicker
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/controls/pickers.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Progress & Activity
|
||||
page.tags="progressbar","download","network"
|
||||
page.tags=progressbar,download,network
|
||||
@jd:body
|
||||
|
||||
<p>Progress bars and activity indicators signal to users that something is happening that will take a moment.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Scrolling
|
||||
page.tags="scrollview","listview"
|
||||
page.tags=scrollview,listview
|
||||
@jd:body
|
||||
|
||||
<p>Scrolling allows the user to navigate to content in the overflow using a swipe gesture. The
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Seek Bars and Sliders
|
||||
page.tags="seekbar","progressbar"
|
||||
page.tags=seekbar,progressbar
|
||||
@jd:body
|
||||
|
||||
<p>Interactive sliders make it possible to select a value from a continuous or discrete range of values
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Spinners
|
||||
page.tags="spinner","dropdown"
|
||||
page.tags=spinner,dropdown
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/controls/spinner.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Switches
|
||||
page.tags="switch","checkbox","radiobutton","button"
|
||||
page.tags=switch,checkbox,radiobutton,button
|
||||
@jd:body
|
||||
|
||||
<p>Switches allow the user to select options. There are three kinds of switches: checkboxes, radio
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Tabs
|
||||
page.tags="tabs","actionbar","navigation","viewpager"
|
||||
page.tags=tabs,actionbar,navigation,viewpager
|
||||
@jd:body
|
||||
|
||||
<img src="{@docRoot}design/media/tabs_overview.png">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Text Fields
|
||||
page.tags="text","edittext","input"
|
||||
page.tags=text,edittext,input
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/controls/text.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Downloads
|
||||
page tags="Icons", "stencils", "color swatches"
|
||||
page.tags=Icons,stencils,color swatches
|
||||
@jd:body
|
||||
|
||||
<div class="layout-content-row">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Accessibility
|
||||
page.tags="accessibility","navigation","input"
|
||||
page.tags=accessibility,navigation,input
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}training/accessibility/index.html">
|
||||
@@ -86,4 +86,4 @@ page.tags="accessibility","navigation","input"
|
||||
<li>Provide alternatives to affordances that time out</li>
|
||||
<li>Use standard framework controls or enable TalkBack for custom controls</li>
|
||||
<li>Try it out yourself</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Action Bar
|
||||
page.tags="actionbar","navigation"
|
||||
page.tags=actionbar,navigation
|
||||
@jd:body
|
||||
|
||||
<img src="{@docRoot}design/media/action_bar_pattern_overview.png">
|
||||
@@ -277,4 +277,4 @@ actions exceeds the capacity of the main action bar, display them separately in
|
||||
<p>Sometimes it is important to display contextual information for your app that's always visible.
|
||||
Examples are the number of unread messages in a messaging inbox view or the Now Playing information
|
||||
in a music player. Carefully plan which important information you would like to display and
|
||||
structure your action bars accordingly.</p>
|
||||
structure your action bars accordingly.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=App Structure
|
||||
page.tags="navigation","layout","tablet"
|
||||
page.tags=navigation,layout,tablet
|
||||
@jd:body
|
||||
|
||||
<p>Apps come in many varieties that address very different needs. For example:</p>
|
||||
@@ -307,4 +307,4 @@ design guide.</p>
|
||||
<li>
|
||||
<p>Allow for quick navigation between detail items with swipe views.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Buttons
|
||||
page.tags="buttons"
|
||||
page.tags=buttons
|
||||
@jd:body
|
||||
|
||||
<p>
|
||||
@@ -148,4 +148,4 @@ page.tags="buttons"
|
||||
Replace previous implementations of Lights Out mode with the Lean Back or
|
||||
Immersive approaches. Continue to use Lights Out mode for implementations of
|
||||
your app targeted for earlier releases.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Backwards Compatibility
|
||||
page.tags="support"
|
||||
page.tags=support
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}training/basics/supporting-devices/index.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Confirming & Acknowledging
|
||||
page.tags="dialog","toast","notification"
|
||||
page.tags=dialog,toast,notification
|
||||
@jd:body
|
||||
|
||||
<p>In some situations, when a user invokes an action in your app, it's a good idea to <em>confirm</em> or <em>acknowledge</em> that action through text.</p>
|
||||
@@ -67,4 +67,4 @@ page.tags="dialog","toast","notification"
|
||||
<p><strong>Acknowledgment is unnecessary</strong>. The user will know the app is gone from the Home Screen because they made it disappear by dragging it away.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Full Screen
|
||||
page.tags="full screen","immersive", "leanback"
|
||||
page.tags=full screen,immersive,leanback
|
||||
@jd:body
|
||||
|
||||
<p>
|
||||
@@ -148,4 +148,4 @@ page.tags="full screen","immersive", "leanback"
|
||||
Replace previous implementations of Lights Out mode with the Lean Back or
|
||||
Immersive approaches. Continue to use Lights Out mode for implementations of
|
||||
your app targeted for earlier releases.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Gestures
|
||||
page.tags="gesture","input","touch"
|
||||
page.tags=gesture,input,touch
|
||||
@jd:body
|
||||
|
||||
<p>Gestures allow users to interact with your app by manipulating the screen objects you provide. The
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Help
|
||||
page.tags="settings","preferences"
|
||||
page.tags=settings,preferences
|
||||
@jd:body
|
||||
|
||||
<p>We wish we could guarantee that if you follow every piece of advice on this website, everyone will be able to learn and use your app without a hitch. Sadly, that's not the case.</p>
|
||||
@@ -110,4 +110,4 @@ page.tags="settings","preferences"
|
||||
<p>People don't read help from start to finish. They scan around, looking for a piece of information containing the answer they need. Make it less burdensome with friendly formatting and layout choices like bold headings, bulleted and numbered lists, tables, and white space between paragraphs. And if you have a large amount of content, divide it into multiple screens to cut down on scrolling.</p>
|
||||
|
||||
<h4>Take me straight to the answer</h4>
|
||||
<p>What's better than a screen that's easy to scan? A screen that requires no scanning at all because the answer's right there. Consider having each screen in your app navigate to help that's relevant just to that screen. We call this <em>contextual help</em>, and it's the holy grail of user assistance. If you take this approach, be sure to also provide a way to get to the rest of the help content.</p>
|
||||
<p>What's better than a screen that's easy to scan? A screen that requires no scanning at all because the answer's right there. Consider having each screen in your app navigate to help that's relevant just to that screen. We call this <em>contextual help</em>, and it's the holy grail of user assistance. If you take this approach, be sure to also provide a way to get to the rest of the help content.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Multi-pane Layouts
|
||||
page.tags="tablet","navigation","layout","fragment"
|
||||
page.tags=tablet,navigation,layout,fragment
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Navigation Drawer
|
||||
page.tags="DrawerLayout","SlidingPaneLayout"
|
||||
page.tags=DrawerLayout,SlidingPaneLayout
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Navigation with Back and Up
|
||||
page.tags="navigation","activity","task","up navigation","back navigation"
|
||||
page.tags=navigation,activity,task,up navigation,back navigation
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}training/implementing-navigation/index.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=New in Android
|
||||
page.tags="KitKat", "Android 4.4"
|
||||
page.tags=KitKat,Android 4.4
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Selection
|
||||
page.tags="actionmode","navigation","contextual"
|
||||
page.tags=actionmode,navigation,contextual
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/menus.html#context-menu">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Settings
|
||||
page.tags="preferences","sharedpreferences"
|
||||
page.tags=preferences,sharedpreferences
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/ui/settings.html">
|
||||
@@ -696,4 +696,4 @@ it doesn't mean anything to most users and would have taken up a lot of space.</
|
||||
<li><p>Use design patterns wherever applicable so users don't face a learning curve.</p></li>
|
||||
<li><p>Choose defaults that are safe, neutral, and fit the majority of users.</p></li>
|
||||
<li><p>Give each setting a clear, concise label and use secondary text appropriately.</p></li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Swipe Views
|
||||
page.tags="viewpager","navigation","tabs"
|
||||
page.tags=viewpager,navigation,tabs
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}training/implementing-navigation/lateral.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Widgets
|
||||
page.tags="appwidget","home"
|
||||
page.tags=appwidget,home
|
||||
@jd:body
|
||||
|
||||
<a class="notice-developers" href="{@docRoot}guide/topics/appwidgets/index.html">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Your Branding
|
||||
page.tags="branding","logo"
|
||||
page.tags=branding,logo
|
||||
@jd:body
|
||||
|
||||
<p>Following Android design patterns doesn't mean that your app has to look the same as
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Iconography
|
||||
page.tags="icons"
|
||||
page.tags=icons
|
||||
@jd:body
|
||||
|
||||
<img src="{@docRoot}design/media/iconography_overview.png">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Metrics and Grids
|
||||
page.tags="layout","screens"
|
||||
page.tags=layout,screens
|
||||
@jd:body
|
||||
|
||||
<p>Devices vary not only in physical size, but also in screen density (<acronym title="Dots per
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Touch Feedback
|
||||
page.tags="input","button"
|
||||
page.tags=input,button
|
||||
@jd:body
|
||||
|
||||
<div class="layout-content-row" style="margin-bottom: -100px">
|
||||
@@ -83,4 +83,4 @@ item to be removed.</p>
|
||||
widgets, like lists and grid lists, have support for boundary feedback built
|
||||
in. If you’re building custom widgets, keep boundary feedback in mind and
|
||||
provide it from within your app.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Typography
|
||||
page.tags="textview","font"
|
||||
page.tags=textview,font
|
||||
@jd:body
|
||||
|
||||
<div class="layout-content-row">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Writing Style
|
||||
page.tags="dialog","toast","notification"
|
||||
page.tags=dialog,toast,notification
|
||||
@jd:body
|
||||
|
||||
<h2 id="voa">Android's Voice</h2>
|
||||
@@ -319,4 +319,4 @@ will not, you will</td>
|
||||
ellipsis. </li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google Play for Education
|
||||
page.tags="Google Play","education","schools", "distribution"
|
||||
page.tags=Google Play,education,schools,distribution
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Localization Checklist
|
||||
page.tags="localize","localization","resources", "formats", "l10n"
|
||||
page.tags=localize,localization,resources,formats,l10n
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper"><div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Launch Checklist
|
||||
page.tags="publishing","launch","Google Play", "Developer Console"
|
||||
page.tags=publishing,launch,Google Play,Developer Console
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper"><div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Implementing GCM Client
|
||||
page.tags="cloud","push","messaging"
|
||||
page.tags=cloud,push,messaging
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Getting Started
|
||||
page.tags="cloud","push","messaging"
|
||||
page.tags=cloud,push,messaging
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Using the GCM Helper Libraries
|
||||
page.tags="cloud","push","messaging"
|
||||
page.tags=cloud,push,messaging
|
||||
@jd:body
|
||||
|
||||
<div id="deprecatedSticker">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google Cloud Messaging for Android
|
||||
page.tags="gcm"
|
||||
page.tags=gcm
|
||||
header.hide=1
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google Mobile Ads
|
||||
page.tags="Ads","monetization", "AdMob", "Google Play services"
|
||||
page.tags=Ads,monetization,AdMob,Google Play services
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
@@ -82,4 +82,4 @@ header.hide=1
|
||||
<p class="note"><strong>Note</strong>: The SDK doesn’t currently support DFP, Ad Exchange or Search
|
||||
Ads for Mobile Apps but support is coming soon.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Authorization
|
||||
page.tags="AccountManager","oauth2"
|
||||
page.tags=AccountManager,oauth2
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -236,4 +236,4 @@ if (serverCode == 200) {
|
||||
case, obtain a new token using <a
|
||||
href="{@docRoot}reference/com/google/android/gms/auth/GoogleAuthUtil.html#getToken(android.content.Context, java.lang.String, java.lang.String)"
|
||||
>{@code GoogleAuthUtil.getToken()}</a>.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Advertising ID
|
||||
page.tags="Ads","Advertising ID", "ID"
|
||||
page.tags=Ads,Advertising ID,ID
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
@@ -195,4 +195,4 @@ public void getIdThread() {
|
||||
}
|
||||
final String id = adInfo.getId();
|
||||
final boolean isLAT = adInfo.isLimitAdTrackingEnabled();
|
||||
}</pre>
|
||||
}</pre>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Location APIs
|
||||
page.tags="location","geofence", "geofencing", "gps"
|
||||
page.tags=location,geofence,geofencing,gps
|
||||
header.hide=1
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google Maps Android API
|
||||
page.tags="mapview","location"
|
||||
page.tags=mapview,location
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
@@ -88,4 +88,4 @@ href="https://developers.google.com/maps/documentation/android/">developers.goog
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google+ Platform for Android
|
||||
page.tags="authentication","signin","social"
|
||||
page.tags=authentication,signin,social
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
@@ -87,4 +87,4 @@ information about integrating Google+ into your app.</p>
|
||||
Google+ developer documents at <a class="external-link"
|
||||
href="https://developers.google.com/+/mobile/android/">developers.google.com/+</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Google Wallet Instant Buy for Android
|
||||
page.tags="Wallet","payments","Instant Buy"
|
||||
page.tags=Wallet,payments,Instant Buy
|
||||
header.hide=1
|
||||
|
||||
@jd:body
|
||||
@@ -83,4 +83,4 @@ header.hide=1
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Purchase Status API
|
||||
page.tags="In-app Billing", "Google Play", "inapp billing", "in app billing", "iab", "billing"
|
||||
page.tags=In-app Billing,Google Play,inapp billing,in app billing,iab,billing
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Supported Media Formats
|
||||
page.tags="video","audio","mpeg","mp4","m4a","mp3","3gp","3gpp","flac","wave","wav"
|
||||
page.tags=video,audio,mpeg,mp4,m4a,mp3,3gp,3gpp,flac,wave,wav
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Activities
|
||||
page.tags="activity","intent"
|
||||
page.tags=activity,intent
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Processes and Threads
|
||||
page.tags="lifecycle","background"
|
||||
page.tags=lifecycle,background
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Device Administration
|
||||
page.tags="devicepolicymanager","policy","security"
|
||||
page.tags=devicepolicymanager,policy,security
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=App Widget Host
|
||||
page.tags="AppWidgetHost","home screen","launcher"
|
||||
page.tags=AppWidgetHost,home screen,launcher
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=App Widgets
|
||||
page.tags="home","AppWidgetProvider"
|
||||
page.tags=home,AppWidgetProvider
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Bluetooth Low Energy
|
||||
page.tags="wireless","bluetoothadapter","bluetoothdevice","BLE","BTLE"
|
||||
page.tags=wireless,bluetoothadapter,bluetoothdevice,BLE,BTLE
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Bluetooth
|
||||
page.tags="wireless","bluetoothadapter","bluetoothdevice"
|
||||
page.tags=wireless,bluetoothadapter,bluetoothdevice
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Host-based Card Emulation
|
||||
page.tags="host card emulation", "hce","HostApduService","OffHostApduService","tap and pay"
|
||||
page.tags=host card emulation,hce,HostApduService,OffHostApduService,tap and pay
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Session Initiation Protocol
|
||||
page.tags="sipmanager","sipprofile","sipaudiocall","telephony"
|
||||
page.tags=sipmanager,sipprofile,sipaudiocall,telephony
|
||||
@jd:body
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Wi-Fi Peer-to-Peer
|
||||
page.tags="wireless","WifiP2pManager","Wi-Fi Direct","WiFi Direct","P2P","Wi-Fi P2P","WiFi P2P"
|
||||
page.tags=wireless,WifiP2pManager,Wi-Fi Direct,WiFi Direct,P2P,Wi-Fi P2P,WiFi P2P
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Storage Options
|
||||
page.tags="database","sharedpreferences","sdcard"
|
||||
page.tags=database,sharedpreferences,sdcard
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=App Install Location
|
||||
page.tags="sdcard","external"
|
||||
page.tags=sdcard,external
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=OpenGL ES
|
||||
page.tags="games"
|
||||
page.tags=games
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Property Animation
|
||||
page.tags="valueanimator","objectanimator","layouttransition","ViewPropertyAnimator"
|
||||
page.tags=valueanimator,objectanimator,layouttransition,ViewPropertyAnimator
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=<uses-feature>
|
||||
page.tags="filtering","features","google play filters","permissions"
|
||||
page.tags=filtering,features,google play filters,permissions
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -1071,4 +1071,4 @@ filtering based on the <code>CAMERA</code> permission, you would add this
|
||||
<td><code>android.hardware.wifi</code></td>
|
||||
<!-- <td></td> -->
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=<uses-sdk>
|
||||
page.tags="api levels","sdk version","minsdkversion","targetsdkversion","maxsdkversion"
|
||||
page.tags=api levels,sdk version,minsdkversion,targetsdkversion,maxsdkversion
|
||||
@jd:body
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Audio Capture
|
||||
page.tags="mediarecorder"
|
||||
page.tags=mediarecorder
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -249,4 +249,4 @@ public class AudioRecordTest extends Activity
|
||||
}
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Camera
|
||||
page.tags="photo","video","picture","mediarecorder"
|
||||
page.tags=photo,video,picture,mediarecorder
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Media Playback
|
||||
page.tags="mediaplayer","soundpool","audiomanager"
|
||||
page.tags=mediaplayer,soundpool,audiomanager
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -743,4 +743,4 @@ mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
mMediaPlayer.setDataSource(getApplicationContext(), contentUri);
|
||||
|
||||
// ...prepare and start...
|
||||
</pre>
|
||||
</pre>
|
||||
|
||||
@@ -1,487 +1,485 @@
|
||||
page.title=Localizing with Resources
|
||||
parent.title=Application Resources
|
||||
page.tags="localizing","localization","resources", "formats", "l10n"
|
||||
parent.link=index.html
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
<h2>Quickview</h2>
|
||||
|
||||
<ul>
|
||||
<li>Use resource sets to create a localized app.</li>
|
||||
<li>Android loads the correct resource set for the user's language and locale.</li>
|
||||
<li>If localized resources are not available, Android loads your default resources.</li>
|
||||
</ul>
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<li><a href="#resource-switching">Overview: Resource-Switching in Android</a></li>
|
||||
<li><a href="#using-framework">Using Resources for Localization</a></li>
|
||||
<li><a href="#strategies">Localization Tips</a></li>
|
||||
<li><a href="#testing">Testing Localized Applications</a></li>
|
||||
</ol>
|
||||
|
||||
<h2>See also</h2>
|
||||
<ol>
|
||||
<li><a href="{@docRoot}distribute/googleplay/publish/localizing.html">Localization Checklist</a></li>
|
||||
<li><a href="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a></li>
|
||||
<li><a href="{@docRoot}guide/topics/ui/declaring-layout.html">Layouts</a></li>
|
||||
<li><a href="{@docRoot}reference/android/app/Activity.html#ActivityLifecycle">Activity Lifecycle</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Android will run on many devices in many regions. To reach the most users,
|
||||
your application should handle text, audio files, numbers, currency, and
|
||||
graphics in ways appropriate to the locales where your application will be used.
|
||||
</p>
|
||||
|
||||
<p>This document describes best practices for localizing Android
|
||||
applications. The principles apply whether you are developing your application
|
||||
using ADT with Eclipse, Ant-based tools, or any other IDE. </p>
|
||||
|
||||
<p>You should already have a working knowledge of Java and be familiar with
|
||||
Android resource loading, the declaration of user interface elements in XML,
|
||||
development considerations such as Activity lifecycle, and general principles of
|
||||
internationalization and localization. </p>
|
||||
|
||||
<p>It is good practice to use the Android resource framework to separate the
|
||||
localized aspects of your application as much as possible from the core Java
|
||||
functionality:</p>
|
||||
|
||||
<ul>
|
||||
<li>You can put most or all of the <em>contents</em> of your application's
|
||||
user interface into resource files, as described in this document and in <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a>.</li>
|
||||
<li>The <em>behavior</em> of the user interface, on the other hand, is driven
|
||||
by your Java code.
|
||||
For example, if users input data that needs to be formatted or sorted
|
||||
differently depending on locale, then you would use Java to handle the data
|
||||
programmatically. This document does not cover how to localize your Java code.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>For a short guide to localizing strings in your app, see the training lesson, <a
|
||||
href="{@docRoot}training/basics/supporting-devices/languages.html">Supporting Different Languages</a>. </p>
|
||||
|
||||
|
||||
<h2 id="resource-switching">Overview: Resource-Switching in Android</h2>
|
||||
|
||||
<p>Resources are text strings, layouts, sounds, graphics, and any other static
|
||||
data that your Android application needs. An application can include multiple
|
||||
sets of resources, each customized for a different device configuration. When a
|
||||
user runs the application, Android automatically selects and loads the
|
||||
resources that best match the device.</p>
|
||||
|
||||
<p>(This document focuses on localization and locale. For a complete description
|
||||
of resource-switching and all the types of configurations that you can
|
||||
specify — screen orientation, touchscreen type, and so on — see <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
|
||||
Alternative Resources</a>.)</p>
|
||||
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr border="0">
|
||||
<td width="180" style="border: 0pt none ;"><p class="special-note">
|
||||
<strong>When you write your application:</strong>
|
||||
<br><br>
|
||||
You create a set of default resources, plus alternatives to be used in
|
||||
different locales.</p></td>
|
||||
<td style="border: 0pt none; padding:0">
|
||||
<p style="border:0; padding:0"><img src="../../../images/resources/right-arrow.png" alt="right-arrow"
|
||||
width="51" height="17"></p></td>
|
||||
<td width="180" style="border: 0pt none ;"><p class="special-note">
|
||||
<strong>When a user runs your application:</strong>
|
||||
<br><br>The Android system selects which resources to load, based on the
|
||||
device's locale.</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>When you write your application, you create default and alternative resources
|
||||
for your application to use. To create resources, you place files within
|
||||
specially named subdirectories of the project's <code>res/</code> directory.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3 id="defaults-r-important">Why Default Resources Are Important</h3>
|
||||
|
||||
<p>Whenever the application runs in a locale for which you have not provided
|
||||
locale-specific text, Android will load the default strings from
|
||||
<code>res/values/strings.xml</code>. If this default file is absent, or if it
|
||||
is missing a string that your application needs, then your application will not run
|
||||
and will show an error.
|
||||
The example below illustrates what can happen when the default text file is incomplete. </p>
|
||||
|
||||
<p><em>Example:</em>
|
||||
<p>An application's Java code refers to just two strings, <code>text_a</code> and
|
||||
<code>text_b</code>. This application includes a localized resource file
|
||||
(<code>res/values-en/strings.xml</code>) that defines <code>text_a</code> and
|
||||
<code>text_b</code> in English. This application also includes a default
|
||||
resource file (<code>res/values/strings.xml</code>) that includes a
|
||||
definition for <code>text_a</code>, but not for <code>text_b</code>:
|
||||
<ul>
|
||||
<li>This application might compile without a problem. An IDE such as Eclipse
|
||||
will not highlight any errors if a resource is missing.</li>
|
||||
<li>When this application is launched on a device with locale set to English,
|
||||
the application might run without a problem, because
|
||||
<code>res/values-en/strings.xml</code> contains both of the needed text
|
||||
strings.</li>
|
||||
<li>However, <strong>the user will see an error message and a Force Close
|
||||
button</strong> when this application is launched on a device set to a
|
||||
language other than English. The application will not load.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>To prevent this situation, make sure that a <code>res/values/strings.xml</code>
|
||||
file exists and that it defines every needed string. The situation applies to
|
||||
all types of resources, not just strings: You
|
||||
need to create a set of default resource files containing all
|
||||
the resources that your application calls upon — layouts, drawables,
|
||||
animations, etc. For information about testing, see <a href="#test-for-default">
|
||||
Testing for Default Resources</a>.</p>
|
||||
|
||||
<h2 id="using-framework">Using Resources for Localization</h2>
|
||||
|
||||
<h3 id="creating-defaults">How to Create Default Resources</h3>
|
||||
|
||||
<p>Put the application's default text in
|
||||
a file with the following location and name:</p>
|
||||
<p><code> res/values/strings.xml</code> (required directory)</p>
|
||||
|
||||
<p>The text strings in <code>res/values/strings.xml</code> should use the
|
||||
default language, which is the language that you expect most of your application's users to
|
||||
speak. </p>
|
||||
|
||||
<p>The default resource set must also include any default drawables and layouts,
|
||||
and can include other types of resources such as animations.
|
||||
<br>
|
||||
<code> res/drawable/</code>(required directory holding at least
|
||||
one graphic file, for the application's icon on Google Play)<br>
|
||||
<code> res/layout/</code> (required directory holding an XML
|
||||
file that defines the default layout)<br>
|
||||
<code> res/anim/</code> (required if you have any
|
||||
<code>res/anim-<em><qualifiers></em></code> folders)<br>
|
||||
<code> res/xml/</code> (required if you have any
|
||||
<code>res/xml-<em><qualifiers></em></code> folders)<br>
|
||||
<code> res/raw/</code> (required if you have any
|
||||
<code>res/raw-<em><qualifiers></em></code> folders)
|
||||
</p>
|
||||
|
||||
<p class="note"><strong>Tip:</strong> In your code, examine each reference to
|
||||
an Android resource. Make sure that a default resource is defined for each
|
||||
one. Also make sure that the default string file is complete: A <em>
|
||||
localized</em> string file can contain a subset of the strings, but the
|
||||
<em>default</em> string file must contain them all.
|
||||
</p>
|
||||
|
||||
<h3 id="creating-alternatives">How to Create Alternative Resources</h3>
|
||||
|
||||
<p>A large part of localizing an application is providing alternative text for
|
||||
different languages. In some cases you will also provide alternative graphics,
|
||||
sounds, layouts, and other locale-specific resources. </p>
|
||||
|
||||
<p>An application can specify many <code>res/<em><qualifiers></em>/</code>
|
||||
directories, each with different qualifiers. To create an alternative resource for
|
||||
a different locale, you use a qualifier that specifies a language or a
|
||||
language-region combination. (The name of a resource directory must conform
|
||||
to the naming scheme described in
|
||||
<a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
|
||||
Alternative Resources</a>,
|
||||
or else it will not compile.)</p>
|
||||
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Suppose that your application's default language is English. Suppose also
|
||||
that you want to localize all the text in your application to French, and most
|
||||
of the text in your application (everything except the application's title) to
|
||||
Japanese. In this case, you could create three alternative <code>strings.xml</code>
|
||||
files, each stored in a locale-specific resource directory:</p>
|
||||
|
||||
<ol>
|
||||
<li><code>res/values/strings.xml</code><br>
|
||||
Contains English text for all the strings that the application uses,
|
||||
including text for a string named <code>title</code>.</li>
|
||||
<li><code>res/values-fr/strings.xml</code><br>
|
||||
Contain French text for all the strings, including <code>title</code>.</li>
|
||||
<li><code>res/values-ja/strings.xml</code><br>
|
||||
Contain Japanese text for all the strings <em>except</em>
|
||||
<code>title</code>.<br>
|
||||
<code></code></li>
|
||||
</ol>
|
||||
|
||||
<p>If your Java code refers to <code>R.string.title</code>, here is what will
|
||||
happen at runtime:</p>
|
||||
|
||||
<ul>
|
||||
<li>If the device is set to any language other than French, Android will load
|
||||
<code>title</code> from the <code>res/values/strings.xml</code> file.</li>
|
||||
<li>If the device is set to French, Android will load <code>title</code> from
|
||||
the <code>res/values-fr/strings.xml</code> file.</li>
|
||||
</ul>
|
||||
|
||||
<p>Notice that if the device is set to Japanese, Android will look for
|
||||
<code>title</code> in the <code>res/values-ja/strings.xml</code> file. But
|
||||
because no such string is included in that file, Android will fall back to the
|
||||
default, and will load <code>title</code> in English from the
|
||||
<code>res/values/strings.xml</code> file. </p>
|
||||
|
||||
<h3 id="resource-precedence">Which Resources Take Precedence?</h3>
|
||||
|
||||
<p> If multiple resource files match a device's configuration, Android follows a
|
||||
set of rules in deciding which file to use. Among the qualifiers that can be
|
||||
specified in a resource directory name, <strong>locale almost always takes
|
||||
precedence</strong>. </p>
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Assume that an application includes a default set of graphics and two other
|
||||
sets of graphics, each optimized for a different device setup:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>res/drawable/</code><br>
|
||||
Contains
|
||||
default graphics.</li>
|
||||
<li><code>res/drawable-small-land-stylus/</code><br>
|
||||
Contains graphics optimized for use with a device that expects input from a
|
||||
stylus and has a QVGA low-density screen in landscape orientation.</li>
|
||||
<li><code>res/drawable-ja/</code> <br>
|
||||
Contains graphics optimized for use with Japanese.</li>
|
||||
</ul>
|
||||
|
||||
<p>If the application runs on a device that is configured to use Japanese,
|
||||
Android will load graphics from <code>res/drawable-ja/</code>, even if the
|
||||
device happens to be one that expects input from a stylus and has a QVGA
|
||||
low-density screen in landscape orientation.</p>
|
||||
|
||||
<p class="note"><strong>Exception:</strong> The only qualifiers that take
|
||||
precedence over locale in the selection process are MCC and MNC (mobile country
|
||||
code and mobile network code). </p>
|
||||
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Assume that you have the following situation:</p>
|
||||
|
||||
<ul>
|
||||
<li>The application code calls for <code>R.string.text_a</code></li>
|
||||
<li>Two relevant resource files are available:
|
||||
<ul>
|
||||
<li><code>res/values-mcc404/strings.xml</code>, which includes
|
||||
<code>text_a</code> in the application's default language, in this case
|
||||
English.</li>
|
||||
<li><code>res/values-hi/strings.xml</code>, which includes
|
||||
<code>text_a</code> in Hindi.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>The application is running on a device that has the following
|
||||
configuration:
|
||||
<ul>
|
||||
<li>The SIM card is connected to a mobile network in India (MCC 404).</li>
|
||||
<li>The language is set to Hindi (<code>hi</code>).</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Android will load <code>text_a</code> from
|
||||
<code>res/values-mcc404/strings.xml</code> (in English), even if the device is
|
||||
configured for Hindi. That is because in the resource-selection process, Android
|
||||
will prefer an MCC match over a language match. </p>
|
||||
|
||||
<p>The selection process is not always as straightforward as these examples
|
||||
suggest. Please read <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#BestMatch">How Android Finds
|
||||
the Best-matching Resource</a> for a more nuanced description of the
|
||||
process. All the qualifiers are described and listed in order of
|
||||
precedence in <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#table2">Table 2 of Providing
|
||||
Alternative Resources</a>.</p>
|
||||
|
||||
<h3 id="referring-to-resources">Referring to Resources in Java</h3>
|
||||
|
||||
<p>In your application's Java code, you refer to resources using the syntax
|
||||
<code>R.<em>resource_type</em>.<em>resource_name</em></code> or
|
||||
<code>android.R.<em>resource_type</em>.<em>resource_name</em></code><em>.</em>
|
||||
For more about this, see <a
|
||||
href="{@docRoot}guide/topics/resources/accessing-resources.html">Accessing Resources</a>.</p>
|
||||
|
||||
<h2 id="checklist">Localization Checklist</h2>
|
||||
|
||||
<p>For a complete overview of the process of localizing and distributing an Android application,
|
||||
see the <a href="{@docRoot}distribute/googleplay/publish/localizing.html">Localization
|
||||
Checklist</a> document.</p>
|
||||
|
||||
<h2 id="strategies">Localization Tips</h2>
|
||||
|
||||
<h4 id="failing2">Design your application to work in any locale</h4>
|
||||
|
||||
<p>You cannot assume anything about the device on which a user will
|
||||
run your application. The device might have hardware that you were not
|
||||
anticipating, or it might be set to a locale that you did not plan for or that
|
||||
you cannot test. Design your application so that it will function normally or fail gracefully no
|
||||
matter what device it runs on.</p>
|
||||
|
||||
<p class="note"><strong>Important:</strong> Make sure that your application
|
||||
includes a full set of default resources.</p> <p>Make sure to include
|
||||
<code>res/drawable/</code> and a <code>res/values/</code> folders (without any
|
||||
additional modifiers in the folder names) that contain all the images and text
|
||||
that your application will need. </p>
|
||||
|
||||
<p>If an application is missing even one default resource, it will not run on a
|
||||
device that is set to an unsupported locale. For example, the
|
||||
<code>res/values/strings.xml</code> default file might lack one string that
|
||||
the application needs: When the application runs in an unsupported locale and
|
||||
attempts to load <code>res/values/strings.xml</code>, the user will see an
|
||||
error message and a Force Close button. An IDE such as Eclipse will not
|
||||
highlight this kind of error, and you will not see the problem when you
|
||||
test the application on a device or emulator that is set to a supported locale.</p>
|
||||
|
||||
<p>For more information, see <a href="#test-for-default">Testing for Default Resources</a>.</p>
|
||||
|
||||
<h4>Design a flexible layout</h4>
|
||||
|
||||
<p> If you need to rearrange your layout to fit a certain language (for example
|
||||
German with its long words), you can create an alternative layout for that
|
||||
language (for example <code>res/layout-de/main.xml</code>). However, doing this
|
||||
can make your application harder to maintain. It is better to create a single
|
||||
layout that is more flexible.</p>
|
||||
|
||||
<p>Another typical situation is a language that requires something different in
|
||||
its layout. For example, you might have a contact form that should include two
|
||||
name fields when the application runs in Japanese, but three name fields when
|
||||
the application runs in some other language. You could handle this in either of
|
||||
two ways:</p>
|
||||
|
||||
<ul>
|
||||
<li>Create one layout with a field that you can programmatically enable or
|
||||
disable, based on the language, or</li>
|
||||
<li>Have the main layout include another layout that includes the changeable
|
||||
field. The second layout can have different configurations for different
|
||||
languages.</li>
|
||||
</ul>
|
||||
|
||||
<h4>Avoid creating more resource files and text strings than you need</h4>
|
||||
|
||||
<p>You probably do not need to create a locale-specific
|
||||
alternative for every resource in your application. For example, the layout
|
||||
defined in the <code>res/layout/main.xml</code> file might work in any locale,
|
||||
in which case there would be no need to create any alternative layout files.
|
||||
</p>
|
||||
|
||||
<p>Also, you might not need to create alternative text for every
|
||||
string. For example, assume the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Your application's default language is American
|
||||
English. Every string that the application uses is defined, using American
|
||||
English spellings, in <code>res/values/strings.xml</code>. </li>
|
||||
|
||||
<li>For a few important phrases, you want to provide
|
||||
British English spelling. You want these alternative strings to be used when your
|
||||
application runs on a device in the United Kingdom. </li>
|
||||
</ul>
|
||||
|
||||
<p>To do this, you could create a small file called
|
||||
<code>res/values-en-rGB/strings.xml</code> that includes only the strings that
|
||||
should be different when the application runs in the U.K. For all the rest of
|
||||
the strings, the application will fall back to the defaults and use what is
|
||||
defined in <code>res/values/strings.xml</code>.</p>
|
||||
|
||||
<h4>Use the Android Context object for manual locale lookup</h4>
|
||||
|
||||
<p>You can look up the locale using the {@link android.content.Context} object
|
||||
that Android makes available:</p>
|
||||
|
||||
<pre>String locale = context.getResources().getConfiguration().locale.getDisplayName();</pre>
|
||||
|
||||
<h2 id="testing">Testing Localized Applications</h2>
|
||||
|
||||
<h3 id="device">Testing on a Device</h3>
|
||||
<p>Keep in mind that the device you are testing may be significantly different from
|
||||
the devices available to consumers in other geographies. The locales available
|
||||
on your device may differ from those available on other devices. Also, the
|
||||
resolution and density of the device screen may differ, which could affect
|
||||
the display of strings and drawables in your UI.</p>
|
||||
|
||||
<p>To change the locale on a device, use the Settings application (Home >
|
||||
Menu > Settings > Locale & text > Select locale). </p>
|
||||
|
||||
<h3 id="emulator">Testing on an Emulator</h3>
|
||||
|
||||
<p>For details about using the emulator, see See <a
|
||||
href="{@docRoot}tools/help/emulator.html">Android Emulator</a>.</p>
|
||||
<h4>Creating and using a custom locale</h4>
|
||||
|
||||
<p>A "custom" locale is a language/region combination that the Android
|
||||
system image does not explicitly support. (For a list of supported locales in
|
||||
Android platforms see the Version Notes in the <a
|
||||
href="{@docRoot}sdk/index.html">SDK</a> tab). You can test
|
||||
how your application will run in a custom locale by creating a custom locale in
|
||||
the emulator. There are two ways to do this:</p>
|
||||
|
||||
<ul>
|
||||
<li>Use the Custom Locale application, which is accessible from the
|
||||
Application tab. (After you create a custom locale, switch to it by
|
||||
pressing and holding the locale name.)</li>
|
||||
<li>Change to a custom locale from the adb shell, as described below.</li>
|
||||
</ul>
|
||||
|
||||
<p>When you set the emulator to a locale that is not available in the Android
|
||||
system image, the system itself will display in its default language. Your
|
||||
application, however, should localize properly.</p>
|
||||
|
||||
<h4>Changing the emulator locale from the adb shell</h4>
|
||||
|
||||
<p>To change the locale in the emulator by using the adb shell. </p>
|
||||
|
||||
<ol>
|
||||
<li>Pick the locale you want to test and determine its language and region codes, for
|
||||
example <code>fr</code> for French and <code>CA</code> for Canada.<br>
|
||||
</li>
|
||||
<li>Launch an emulator.</li>
|
||||
<li>From a command-line shell on the host computer, run the following
|
||||
command:<br>
|
||||
<code>adb shell</code><br>
|
||||
or if you have a device attached, specify that you want the emulator by adding
|
||||
the <code>-e</code> option:<br>
|
||||
<code>adb -e shell</code></li>
|
||||
<li>At the adb shell prompt (<code>#</code>), run this command: <br>
|
||||
<code>setprop persist.sys.language [<em>language code</em>];setprop
|
||||
persist.sys.country [<em>country code</em>];stop;sleep 5;start <br>
|
||||
</code>Replace bracketed sections with the appropriate codes from Step
|
||||
1.</li>
|
||||
</ol>
|
||||
|
||||
<p>For instance, to test in Canadian French:</p>
|
||||
|
||||
<p><code>setprop persist.sys.language fr;setprop persist.sys.country
|
||||
CA;stop;sleep 5;start </code></p>
|
||||
|
||||
<p>This will cause the emulator to restart. (It will look like a full reboot,
|
||||
but it is not.) Once the Home screen appears again, re-launch your application (for
|
||||
example, click the Run icon in Eclipse), and the application will launch with
|
||||
the new locale. </p>
|
||||
|
||||
<h3 id="test-for-default">Testing for Default Resources</h3>
|
||||
<p>Here's how to test whether an application includes every string resource that it needs: </p>
|
||||
<ol><li>Set the emulator or device to a language that your application does not
|
||||
support. For example, if the application has French strings in
|
||||
<code>res/values-fr/</code> but does not have any Spanish strings in
|
||||
<code>res/values-es/</code>, then set the emulator's locale to Spanish.
|
||||
(You can use the Custom Locale application to set the emulator to an
|
||||
unsupported locale.)</li>
|
||||
<li>Run the application.</li>
|
||||
<li>If the application shows an error message and a Force Close button, it might
|
||||
be looking for a string that is not available. Make sure that your
|
||||
<code>res/values/strings.xml</code> file includes a definition for
|
||||
every string that the application uses.</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<p>If the test is successful, repeat it for other types of
|
||||
configurations. For example, if the application has a layout file called
|
||||
<code>res/layout-land/main.xml</code> but does not contain a file called
|
||||
<code>res/layout-port/main.xml</code>, then set the emulator or device to
|
||||
portrait orientation and see if the application will run.
|
||||
|
||||
|
||||
|
||||
page.title=Localizing with Resources
|
||||
parent.title=Application Resources
|
||||
page.tags=localizing,localization,resources,formats,l10n
|
||||
parent.link=index.html
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
<h2>Quickview</h2>
|
||||
|
||||
<ul>
|
||||
<li>Use resource sets to create a localized app.</li>
|
||||
<li>Android loads the correct resource set for the user's language and locale.</li>
|
||||
<li>If localized resources are not available, Android loads your default resources.</li>
|
||||
</ul>
|
||||
|
||||
<h2>In this document</h2>
|
||||
<ol>
|
||||
<li><a href="#resource-switching">Overview: Resource-Switching in Android</a></li>
|
||||
<li><a href="#using-framework">Using Resources for Localization</a></li>
|
||||
<li><a href="#strategies">Localization Tips</a></li>
|
||||
<li><a href="#testing">Testing Localized Applications</a></li>
|
||||
</ol>
|
||||
|
||||
<h2>See also</h2>
|
||||
<ol>
|
||||
<li><a href="{@docRoot}distribute/googleplay/publish/localizing.html">Localization Checklist</a></li>
|
||||
<li><a href="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a></li>
|
||||
<li><a href="{@docRoot}guide/topics/ui/declaring-layout.html">Layouts</a></li>
|
||||
<li><a href="{@docRoot}reference/android/app/Activity.html#ActivityLifecycle">Activity Lifecycle</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Android will run on many devices in many regions. To reach the most users,
|
||||
your application should handle text, audio files, numbers, currency, and
|
||||
graphics in ways appropriate to the locales where your application will be used.
|
||||
</p>
|
||||
|
||||
<p>This document describes best practices for localizing Android
|
||||
applications. The principles apply whether you are developing your application
|
||||
using ADT with Eclipse, Ant-based tools, or any other IDE. </p>
|
||||
|
||||
<p>You should already have a working knowledge of Java and be familiar with
|
||||
Android resource loading, the declaration of user interface elements in XML,
|
||||
development considerations such as Activity lifecycle, and general principles of
|
||||
internationalization and localization. </p>
|
||||
|
||||
<p>It is good practice to use the Android resource framework to separate the
|
||||
localized aspects of your application as much as possible from the core Java
|
||||
functionality:</p>
|
||||
|
||||
<ul>
|
||||
<li>You can put most or all of the <em>contents</em> of your application's
|
||||
user interface into resource files, as described in this document and in <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a>.</li>
|
||||
<li>The <em>behavior</em> of the user interface, on the other hand, is driven
|
||||
by your Java code.
|
||||
For example, if users input data that needs to be formatted or sorted
|
||||
differently depending on locale, then you would use Java to handle the data
|
||||
programmatically. This document does not cover how to localize your Java code.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>For a short guide to localizing strings in your app, see the training lesson, <a
|
||||
href="{@docRoot}training/basics/supporting-devices/languages.html">Supporting Different Languages</a>. </p>
|
||||
|
||||
|
||||
<h2 id="resource-switching">Overview: Resource-Switching in Android</h2>
|
||||
|
||||
<p>Resources are text strings, layouts, sounds, graphics, and any other static
|
||||
data that your Android application needs. An application can include multiple
|
||||
sets of resources, each customized for a different device configuration. When a
|
||||
user runs the application, Android automatically selects and loads the
|
||||
resources that best match the device.</p>
|
||||
|
||||
<p>(This document focuses on localization and locale. For a complete description
|
||||
of resource-switching and all the types of configurations that you can
|
||||
specify — screen orientation, touchscreen type, and so on — see <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
|
||||
Alternative Resources</a>.)</p>
|
||||
|
||||
<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr border="0">
|
||||
<td width="180" style="border: 0pt none ;"><p class="special-note">
|
||||
<strong>When you write your application:</strong>
|
||||
<br><br>
|
||||
You create a set of default resources, plus alternatives to be used in
|
||||
different locales.</p></td>
|
||||
<td style="border: 0pt none; padding:0">
|
||||
<p style="border:0; padding:0"><img src="../../../images/resources/right-arrow.png" alt="right-arrow"
|
||||
width="51" height="17"></p></td>
|
||||
<td width="180" style="border: 0pt none ;"><p class="special-note">
|
||||
<strong>When a user runs your application:</strong>
|
||||
<br><br>The Android system selects which resources to load, based on the
|
||||
device's locale.</p></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>When you write your application, you create default and alternative resources
|
||||
for your application to use. To create resources, you place files within
|
||||
specially named subdirectories of the project's <code>res/</code> directory.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3 id="defaults-r-important">Why Default Resources Are Important</h3>
|
||||
|
||||
<p>Whenever the application runs in a locale for which you have not provided
|
||||
locale-specific text, Android will load the default strings from
|
||||
<code>res/values/strings.xml</code>. If this default file is absent, or if it
|
||||
is missing a string that your application needs, then your application will not run
|
||||
and will show an error.
|
||||
The example below illustrates what can happen when the default text file is incomplete. </p>
|
||||
|
||||
<p><em>Example:</em>
|
||||
<p>An application's Java code refers to just two strings, <code>text_a</code> and
|
||||
<code>text_b</code>. This application includes a localized resource file
|
||||
(<code>res/values-en/strings.xml</code>) that defines <code>text_a</code> and
|
||||
<code>text_b</code> in English. This application also includes a default
|
||||
resource file (<code>res/values/strings.xml</code>) that includes a
|
||||
definition for <code>text_a</code>, but not for <code>text_b</code>:
|
||||
<ul>
|
||||
<li>This application might compile without a problem. An IDE such as Eclipse
|
||||
will not highlight any errors if a resource is missing.</li>
|
||||
<li>When this application is launched on a device with locale set to English,
|
||||
the application might run without a problem, because
|
||||
<code>res/values-en/strings.xml</code> contains both of the needed text
|
||||
strings.</li>
|
||||
<li>However, <strong>the user will see an error message and a Force Close
|
||||
button</strong> when this application is launched on a device set to a
|
||||
language other than English. The application will not load.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>To prevent this situation, make sure that a <code>res/values/strings.xml</code>
|
||||
file exists and that it defines every needed string. The situation applies to
|
||||
all types of resources, not just strings: You
|
||||
need to create a set of default resource files containing all
|
||||
the resources that your application calls upon — layouts, drawables,
|
||||
animations, etc. For information about testing, see <a href="#test-for-default">
|
||||
Testing for Default Resources</a>.</p>
|
||||
|
||||
<h2 id="using-framework">Using Resources for Localization</h2>
|
||||
|
||||
<h3 id="creating-defaults">How to Create Default Resources</h3>
|
||||
|
||||
<p>Put the application's default text in
|
||||
a file with the following location and name:</p>
|
||||
<p><code> res/values/strings.xml</code> (required directory)</p>
|
||||
|
||||
<p>The text strings in <code>res/values/strings.xml</code> should use the
|
||||
default language, which is the language that you expect most of your application's users to
|
||||
speak. </p>
|
||||
|
||||
<p>The default resource set must also include any default drawables and layouts,
|
||||
and can include other types of resources such as animations.
|
||||
<br>
|
||||
<code> res/drawable/</code>(required directory holding at least
|
||||
one graphic file, for the application's icon on Google Play)<br>
|
||||
<code> res/layout/</code> (required directory holding an XML
|
||||
file that defines the default layout)<br>
|
||||
<code> res/anim/</code> (required if you have any
|
||||
<code>res/anim-<em><qualifiers></em></code> folders)<br>
|
||||
<code> res/xml/</code> (required if you have any
|
||||
<code>res/xml-<em><qualifiers></em></code> folders)<br>
|
||||
<code> res/raw/</code> (required if you have any
|
||||
<code>res/raw-<em><qualifiers></em></code> folders)
|
||||
</p>
|
||||
|
||||
<p class="note"><strong>Tip:</strong> In your code, examine each reference to
|
||||
an Android resource. Make sure that a default resource is defined for each
|
||||
one. Also make sure that the default string file is complete: A <em>
|
||||
localized</em> string file can contain a subset of the strings, but the
|
||||
<em>default</em> string file must contain them all.
|
||||
</p>
|
||||
|
||||
<h3 id="creating-alternatives">How to Create Alternative Resources</h3>
|
||||
|
||||
<p>A large part of localizing an application is providing alternative text for
|
||||
different languages. In some cases you will also provide alternative graphics,
|
||||
sounds, layouts, and other locale-specific resources. </p>
|
||||
|
||||
<p>An application can specify many <code>res/<em><qualifiers></em>/</code>
|
||||
directories, each with different qualifiers. To create an alternative resource for
|
||||
a different locale, you use a qualifier that specifies a language or a
|
||||
language-region combination. (The name of a resource directory must conform
|
||||
to the naming scheme described in
|
||||
<a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
|
||||
Alternative Resources</a>,
|
||||
or else it will not compile.)</p>
|
||||
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Suppose that your application's default language is English. Suppose also
|
||||
that you want to localize all the text in your application to French, and most
|
||||
of the text in your application (everything except the application's title) to
|
||||
Japanese. In this case, you could create three alternative <code>strings.xml</code>
|
||||
files, each stored in a locale-specific resource directory:</p>
|
||||
|
||||
<ol>
|
||||
<li><code>res/values/strings.xml</code><br>
|
||||
Contains English text for all the strings that the application uses,
|
||||
including text for a string named <code>title</code>.</li>
|
||||
<li><code>res/values-fr/strings.xml</code><br>
|
||||
Contain French text for all the strings, including <code>title</code>.</li>
|
||||
<li><code>res/values-ja/strings.xml</code><br>
|
||||
Contain Japanese text for all the strings <em>except</em>
|
||||
<code>title</code>.<br>
|
||||
<code></code></li>
|
||||
</ol>
|
||||
|
||||
<p>If your Java code refers to <code>R.string.title</code>, here is what will
|
||||
happen at runtime:</p>
|
||||
|
||||
<ul>
|
||||
<li>If the device is set to any language other than French, Android will load
|
||||
<code>title</code> from the <code>res/values/strings.xml</code> file.</li>
|
||||
<li>If the device is set to French, Android will load <code>title</code> from
|
||||
the <code>res/values-fr/strings.xml</code> file.</li>
|
||||
</ul>
|
||||
|
||||
<p>Notice that if the device is set to Japanese, Android will look for
|
||||
<code>title</code> in the <code>res/values-ja/strings.xml</code> file. But
|
||||
because no such string is included in that file, Android will fall back to the
|
||||
default, and will load <code>title</code> in English from the
|
||||
<code>res/values/strings.xml</code> file. </p>
|
||||
|
||||
<h3 id="resource-precedence">Which Resources Take Precedence?</h3>
|
||||
|
||||
<p> If multiple resource files match a device's configuration, Android follows a
|
||||
set of rules in deciding which file to use. Among the qualifiers that can be
|
||||
specified in a resource directory name, <strong>locale almost always takes
|
||||
precedence</strong>. </p>
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Assume that an application includes a default set of graphics and two other
|
||||
sets of graphics, each optimized for a different device setup:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>res/drawable/</code><br>
|
||||
Contains
|
||||
default graphics.</li>
|
||||
<li><code>res/drawable-small-land-stylus/</code><br>
|
||||
Contains graphics optimized for use with a device that expects input from a
|
||||
stylus and has a QVGA low-density screen in landscape orientation.</li>
|
||||
<li><code>res/drawable-ja/</code> <br>
|
||||
Contains graphics optimized for use with Japanese.</li>
|
||||
</ul>
|
||||
|
||||
<p>If the application runs on a device that is configured to use Japanese,
|
||||
Android will load graphics from <code>res/drawable-ja/</code>, even if the
|
||||
device happens to be one that expects input from a stylus and has a QVGA
|
||||
low-density screen in landscape orientation.</p>
|
||||
|
||||
<p class="note"><strong>Exception:</strong> The only qualifiers that take
|
||||
precedence over locale in the selection process are MCC and MNC (mobile country
|
||||
code and mobile network code). </p>
|
||||
|
||||
<p><em>Example:</em></p>
|
||||
|
||||
<p>Assume that you have the following situation:</p>
|
||||
|
||||
<ul>
|
||||
<li>The application code calls for <code>R.string.text_a</code></li>
|
||||
<li>Two relevant resource files are available:
|
||||
<ul>
|
||||
<li><code>res/values-mcc404/strings.xml</code>, which includes
|
||||
<code>text_a</code> in the application's default language, in this case
|
||||
English.</li>
|
||||
<li><code>res/values-hi/strings.xml</code>, which includes
|
||||
<code>text_a</code> in Hindi.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>The application is running on a device that has the following
|
||||
configuration:
|
||||
<ul>
|
||||
<li>The SIM card is connected to a mobile network in India (MCC 404).</li>
|
||||
<li>The language is set to Hindi (<code>hi</code>).</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Android will load <code>text_a</code> from
|
||||
<code>res/values-mcc404/strings.xml</code> (in English), even if the device is
|
||||
configured for Hindi. That is because in the resource-selection process, Android
|
||||
will prefer an MCC match over a language match. </p>
|
||||
|
||||
<p>The selection process is not always as straightforward as these examples
|
||||
suggest. Please read <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#BestMatch">How Android Finds
|
||||
the Best-matching Resource</a> for a more nuanced description of the
|
||||
process. All the qualifiers are described and listed in order of
|
||||
precedence in <a
|
||||
href="{@docRoot}guide/topics/resources/providing-resources.html#table2">Table 2 of Providing
|
||||
Alternative Resources</a>.</p>
|
||||
|
||||
<h3 id="referring-to-resources">Referring to Resources in Java</h3>
|
||||
|
||||
<p>In your application's Java code, you refer to resources using the syntax
|
||||
<code>R.<em>resource_type</em>.<em>resource_name</em></code> or
|
||||
<code>android.R.<em>resource_type</em>.<em>resource_name</em></code><em>.</em>
|
||||
For more about this, see <a
|
||||
href="{@docRoot}guide/topics/resources/accessing-resources.html">Accessing Resources</a>.</p>
|
||||
|
||||
<h2 id="checklist">Localization Checklist</h2>
|
||||
|
||||
<p>For a complete overview of the process of localizing and distributing an Android application,
|
||||
see the <a href="{@docRoot}distribute/googleplay/publish/localizing.html">Localization
|
||||
Checklist</a> document.</p>
|
||||
|
||||
<h2 id="strategies">Localization Tips</h2>
|
||||
|
||||
<h4 id="failing2">Design your application to work in any locale</h4>
|
||||
|
||||
<p>You cannot assume anything about the device on which a user will
|
||||
run your application. The device might have hardware that you were not
|
||||
anticipating, or it might be set to a locale that you did not plan for or that
|
||||
you cannot test. Design your application so that it will function normally or fail gracefully no
|
||||
matter what device it runs on.</p>
|
||||
|
||||
<p class="note"><strong>Important:</strong> Make sure that your application
|
||||
includes a full set of default resources.</p> <p>Make sure to include
|
||||
<code>res/drawable/</code> and a <code>res/values/</code> folders (without any
|
||||
additional modifiers in the folder names) that contain all the images and text
|
||||
that your application will need. </p>
|
||||
|
||||
<p>If an application is missing even one default resource, it will not run on a
|
||||
device that is set to an unsupported locale. For example, the
|
||||
<code>res/values/strings.xml</code> default file might lack one string that
|
||||
the application needs: When the application runs in an unsupported locale and
|
||||
attempts to load <code>res/values/strings.xml</code>, the user will see an
|
||||
error message and a Force Close button. An IDE such as Eclipse will not
|
||||
highlight this kind of error, and you will not see the problem when you
|
||||
test the application on a device or emulator that is set to a supported locale.</p>
|
||||
|
||||
<p>For more information, see <a href="#test-for-default">Testing for Default Resources</a>.</p>
|
||||
|
||||
<h4>Design a flexible layout</h4>
|
||||
|
||||
<p> If you need to rearrange your layout to fit a certain language (for example
|
||||
German with its long words), you can create an alternative layout for that
|
||||
language (for example <code>res/layout-de/main.xml</code>). However, doing this
|
||||
can make your application harder to maintain. It is better to create a single
|
||||
layout that is more flexible.</p>
|
||||
|
||||
<p>Another typical situation is a language that requires something different in
|
||||
its layout. For example, you might have a contact form that should include two
|
||||
name fields when the application runs in Japanese, but three name fields when
|
||||
the application runs in some other language. You could handle this in either of
|
||||
two ways:</p>
|
||||
|
||||
<ul>
|
||||
<li>Create one layout with a field that you can programmatically enable or
|
||||
disable, based on the language, or</li>
|
||||
<li>Have the main layout include another layout that includes the changeable
|
||||
field. The second layout can have different configurations for different
|
||||
languages.</li>
|
||||
</ul>
|
||||
|
||||
<h4>Avoid creating more resource files and text strings than you need</h4>
|
||||
|
||||
<p>You probably do not need to create a locale-specific
|
||||
alternative for every resource in your application. For example, the layout
|
||||
defined in the <code>res/layout/main.xml</code> file might work in any locale,
|
||||
in which case there would be no need to create any alternative layout files.
|
||||
</p>
|
||||
|
||||
<p>Also, you might not need to create alternative text for every
|
||||
string. For example, assume the following:</p>
|
||||
|
||||
<ul>
|
||||
<li>Your application's default language is American
|
||||
English. Every string that the application uses is defined, using American
|
||||
English spellings, in <code>res/values/strings.xml</code>. </li>
|
||||
|
||||
<li>For a few important phrases, you want to provide
|
||||
British English spelling. You want these alternative strings to be used when your
|
||||
application runs on a device in the United Kingdom. </li>
|
||||
</ul>
|
||||
|
||||
<p>To do this, you could create a small file called
|
||||
<code>res/values-en-rGB/strings.xml</code> that includes only the strings that
|
||||
should be different when the application runs in the U.K. For all the rest of
|
||||
the strings, the application will fall back to the defaults and use what is
|
||||
defined in <code>res/values/strings.xml</code>.</p>
|
||||
|
||||
<h4>Use the Android Context object for manual locale lookup</h4>
|
||||
|
||||
<p>You can look up the locale using the {@link android.content.Context} object
|
||||
that Android makes available:</p>
|
||||
|
||||
<pre>String locale = context.getResources().getConfiguration().locale.getDisplayName();</pre>
|
||||
|
||||
<h2 id="testing">Testing Localized Applications</h2>
|
||||
|
||||
<h3 id="device">Testing on a Device</h3>
|
||||
<p>Keep in mind that the device you are testing may be significantly different from
|
||||
the devices available to consumers in other geographies. The locales available
|
||||
on your device may differ from those available on other devices. Also, the
|
||||
resolution and density of the device screen may differ, which could affect
|
||||
the display of strings and drawables in your UI.</p>
|
||||
|
||||
<p>To change the locale on a device, use the Settings application (Home >
|
||||
Menu > Settings > Locale & text > Select locale). </p>
|
||||
|
||||
<h3 id="emulator">Testing on an Emulator</h3>
|
||||
|
||||
<p>For details about using the emulator, see See <a
|
||||
href="{@docRoot}tools/help/emulator.html">Android Emulator</a>.</p>
|
||||
<h4>Creating and using a custom locale</h4>
|
||||
|
||||
<p>A "custom" locale is a language/region combination that the Android
|
||||
system image does not explicitly support. (For a list of supported locales in
|
||||
Android platforms see the Version Notes in the <a
|
||||
href="{@docRoot}sdk/index.html">SDK</a> tab). You can test
|
||||
how your application will run in a custom locale by creating a custom locale in
|
||||
the emulator. There are two ways to do this:</p>
|
||||
|
||||
<ul>
|
||||
<li>Use the Custom Locale application, which is accessible from the
|
||||
Application tab. (After you create a custom locale, switch to it by
|
||||
pressing and holding the locale name.)</li>
|
||||
<li>Change to a custom locale from the adb shell, as described below.</li>
|
||||
</ul>
|
||||
|
||||
<p>When you set the emulator to a locale that is not available in the Android
|
||||
system image, the system itself will display in its default language. Your
|
||||
application, however, should localize properly.</p>
|
||||
|
||||
<h4>Changing the emulator locale from the adb shell</h4>
|
||||
|
||||
<p>To change the locale in the emulator by using the adb shell. </p>
|
||||
|
||||
<ol>
|
||||
<li>Pick the locale you want to test and determine its language and region codes, for
|
||||
example <code>fr</code> for French and <code>CA</code> for Canada.<br>
|
||||
</li>
|
||||
<li>Launch an emulator.</li>
|
||||
<li>From a command-line shell on the host computer, run the following
|
||||
command:<br>
|
||||
<code>adb shell</code><br>
|
||||
or if you have a device attached, specify that you want the emulator by adding
|
||||
the <code>-e</code> option:<br>
|
||||
<code>adb -e shell</code></li>
|
||||
<li>At the adb shell prompt (<code>#</code>), run this command: <br>
|
||||
<code>setprop persist.sys.language [<em>language code</em>];setprop
|
||||
persist.sys.country [<em>country code</em>];stop;sleep 5;start <br>
|
||||
</code>Replace bracketed sections with the appropriate codes from Step
|
||||
1.</li>
|
||||
</ol>
|
||||
|
||||
<p>For instance, to test in Canadian French:</p>
|
||||
|
||||
<p><code>setprop persist.sys.language fr;setprop persist.sys.country
|
||||
CA;stop;sleep 5;start </code></p>
|
||||
|
||||
<p>This will cause the emulator to restart. (It will look like a full reboot,
|
||||
but it is not.) Once the Home screen appears again, re-launch your application (for
|
||||
example, click the Run icon in Eclipse), and the application will launch with
|
||||
the new locale. </p>
|
||||
|
||||
<h3 id="test-for-default">Testing for Default Resources</h3>
|
||||
<p>Here's how to test whether an application includes every string resource that it needs: </p>
|
||||
<ol><li>Set the emulator or device to a language that your application does not
|
||||
support. For example, if the application has French strings in
|
||||
<code>res/values-fr/</code> but does not have any Spanish strings in
|
||||
<code>res/values-es/</code>, then set the emulator's locale to Spanish.
|
||||
(You can use the Custom Locale application to set the emulator to an
|
||||
unsupported locale.)</li>
|
||||
<li>Run the application.</li>
|
||||
<li>If the application shows an error message and a Force Close button, it might
|
||||
be looking for a string that is not available. Make sure that your
|
||||
<code>res/values/strings.xml</code> file includes a definition for
|
||||
every string that the application uses.</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
<p>If the test is successful, repeat it for other types of
|
||||
configurations. For example, if the application has a layout file called
|
||||
<code>res/layout-land/main.xml</code> but does not contain a file called
|
||||
<code>res/layout-port/main.xml</code>, then set the emulator or device to
|
||||
portrait orientation and see if the application will run.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Handling Runtime Changes
|
||||
page.tags="activity","lifecycle"
|
||||
page.tags=activity,lifecycle
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Adding Custom Suggestions
|
||||
page.tags="SearchRecentSuggestionsProvider",
|
||||
page.tags=SearchRecentSuggestionsProvider,
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Adding Recent Query Suggestions
|
||||
page.tags="SearchRecentSuggestions","SearchRecentSuggestionsProvider"
|
||||
page.tags=SearchRecentSuggestions,SearchRecentSuggestionsProvider
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Creating a Search Interface
|
||||
page.tags="searchview"
|
||||
page.tags=searchview
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
page.title=Location and Sensors APIs
|
||||
page.landing=true
|
||||
page.tags="location","sensors"
|
||||
page.tags=location,sensors
|
||||
page.landing.intro=Use sensors on the device to add rich location and motion capabilities to your app, from GPS or network location to accelerometer, gyroscope, temperature, barometer, and more.
|
||||
page.landing.image=
|
||||
|
||||
@@ -38,4 +38,4 @@ practices.</p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Motion Sensors
|
||||
page.tags="sensorevent","accelerometer","gyroscope","gravity","rotation"
|
||||
page.tags=sensorevent,accelerometer,gyroscope,gravity,rotation
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -450,4 +450,4 @@ North Pole.</li>
|
||||
<p>The Android SDK provides a sample application that shows how to use the rotation vector sensor.
|
||||
The sample application is located in the API Demos code (<a
|
||||
href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html">
|
||||
OS - RotationVectorDemo</a>).</p>
|
||||
OS - RotationVectorDemo</a>).</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Position Sensors
|
||||
page.tags="sensorevent","orientation","proximity"
|
||||
page.tags=sensorevent,orientation,proximity
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -313,4 +313,4 @@ public class SensorActivity extends Activity implements SensorEventListener {
|
||||
"near" or "far." In this case, the sensor usually reports its maximum range value in the far state
|
||||
and a lesser value in the near state. Typically, the far value is a value > 5 cm, but this can vary
|
||||
from sensor to sensor. You can determine a sensor's maximum range by using the {@link
|
||||
android.hardware.Sensor#getMaximumRange} method.</p>
|
||||
android.hardware.Sensor#getMaximumRange} method.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Copy and Paste
|
||||
page.tags="clipboardmanager","clipdata","input"
|
||||
page.tags=clipboardmanager,clipdata,input
|
||||
@jd:body
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Creating an Input Method
|
||||
page.tags="ime","keyboard","inputmethodservice"
|
||||
page.tags=ime,keyboard,inputmethodservice
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Spelling Checker Framework
|
||||
page.tags="input","spellcheckerservice"
|
||||
page.tags=input,spellcheckerservice
|
||||
@jd:body
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Action Bar
|
||||
page.tags="actionbar","menu","tabs"
|
||||
page.tags=actionbar,menu,tabs
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Buttons
|
||||
page.tags="button","imagebutton"
|
||||
page.tags=button,imagebutton
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -241,4 +241,4 @@ the image displayed will change based on these three states.</p>
|
||||
<p>For more information about this XML syntax, including how to define a disabled, hovered, or
|
||||
other button states, read about <a
|
||||
href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">State List
|
||||
Drawable</a>.</p>
|
||||
Drawable</a>.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Pickers
|
||||
page.tags="datepicker","timepicker"
|
||||
page.tags=datepicker,timepicker
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Radio Buttons
|
||||
page.tags="radiobutton","radiogroup"
|
||||
page.tags=radiobutton,radiogroup
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Spinners
|
||||
page.tags="adapterview","spinneradapter"
|
||||
page.tags=adapterview,spinneradapter
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -143,4 +143,4 @@ spinner.setOnItemSelectedListener(this);
|
||||
<p>If you implement the {@link
|
||||
android.widget.AdapterView.OnItemSelectedListener} interface with your {@link
|
||||
android.app.Activity} or {@link android.app.Fragment} (such as in the example above), you can pass
|
||||
<code>this</code> as the interface instance.</p>
|
||||
<code>this</code> as the interface instance.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Text Fields
|
||||
page.tags="edittext","autocompletetextview"
|
||||
page.tags=edittext,autocompletetextview
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Toggle Buttons
|
||||
page.tags="switch","togglebutton"
|
||||
page.tags=switch,togglebutton
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Custom Components
|
||||
page.tags="view","widget"
|
||||
page.tags=view,widget
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Layouts
|
||||
page.tags="view","viewgroup"
|
||||
page.tags=view,viewgroup
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Dialogs
|
||||
page.tags="alertdialog","dialogfragment"
|
||||
page.tags=alertdialog,dialogfragment
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Drag and Drop
|
||||
page.tags="clipdata","dragevent","onlongclicklistener"
|
||||
page.tags=clipdata,dragevent,onlongclicklistener
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Grid View
|
||||
page.tags="gridview"
|
||||
page.tags=gridview
|
||||
@jd:body
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Linear Layout
|
||||
page.tags="linearlayout"
|
||||
page.tags=linearlayout
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=List View
|
||||
page.tags="listview"
|
||||
page.tags=listview
|
||||
@jd:body
|
||||
<div id="qv-wrapper">
|
||||
<div id="qv">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Relative Layout
|
||||
page.tags="relativelayout"
|
||||
page.tags=relativelayout
|
||||
@jd:body
|
||||
|
||||
<div id="qv-wrapper">
|
||||
@@ -114,4 +114,4 @@ view declared in the hierarchy. The example below demonstrates such a scenario.<
|
||||
</pre>
|
||||
|
||||
<p>For details about all the layout attributes available to each child view of a {@link
|
||||
android.widget.RelativeLayout}, see {@link android.widget.RelativeLayout.LayoutParams}.</p>
|
||||
android.widget.RelativeLayout}, see {@link android.widget.RelativeLayout.LayoutParams}.</p>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Settings
|
||||
page.tags="preference","preferenceactivity","preferencefragment"
|
||||
page.tags=preference,preferenceactivity,preferencefragment
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Samples
|
||||
page.tags="samples","examples","code"
|
||||
page.tags=samples,examples,code
|
||||
|
||||
@jd:body
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
page.title=Android SDK
|
||||
page.tags="download"
|
||||
page.tags=download
|
||||
page.template=sdk
|
||||
header.hide=1
|
||||
page.metaDescription=Download the official Android SDK to develop apps for Android-powered devices.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user