From ff7c8b9e9d28fa4fb4a5cd43ffc4ffae9b23706e Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Fri, 18 Mar 2016 12:28:06 -0700 Subject: [PATCH] Fix CRLF Change-Id: I6740b5fefae2f16d0ce247ff78e7cb5a6f3f8642 --- docs/docs-redirect-index.html | 16 +- docs/docs-redirect.html | 16 +- docs/docs-samples-redirect.html | 16 +- .../guide/topics/resources/localization.jd | 968 +++++++++--------- docs/overview-ext.html | 16 +- .../location/INetInitiatedListener.aidl | 52 +- .../locationtracker/SettingsActivity.java | 70 +- .../data/TrackerListHelper.java | 150 +-- 8 files changed, 652 insertions(+), 652 deletions(-) diff --git a/docs/docs-redirect-index.html b/docs/docs-redirect-index.html index dc0bc7268f9f3..ea5f1869c6860 100644 --- a/docs/docs-redirect-index.html +++ b/docs/docs-redirect-index.html @@ -1,8 +1,8 @@ - - - - - -click here if you are not redirected - - + + + + + +click here if you are not redirected + + diff --git a/docs/docs-redirect.html b/docs/docs-redirect.html index 4e0743e03a94a..d83564c3f6d64 100644 --- a/docs/docs-redirect.html +++ b/docs/docs-redirect.html @@ -1,8 +1,8 @@ - - - - - -click here if you are not redirected - - + + + + + +click here if you are not redirected + + diff --git a/docs/docs-samples-redirect.html b/docs/docs-samples-redirect.html index 4e549e6556649..abefe6c40017c 100644 --- a/docs/docs-samples-redirect.html +++ b/docs/docs-samples-redirect.html @@ -1,8 +1,8 @@ - - - - - -click here if you are not redirected - - + + + + + +click here if you are not redirected + + diff --git a/docs/html/guide/topics/resources/localization.jd b/docs/html/guide/topics/resources/localization.jd index 0a96a1520ba5f..e60ca9f384e82 100644 --- a/docs/html/guide/topics/resources/localization.jd +++ b/docs/html/guide/topics/resources/localization.jd @@ -1,484 +1,484 @@ -page.title=Localizing with Resources -parent.title=Application Resources -page.tags="localizing","localization","resources", "formats", "l10n" -parent.link=index.html -@jd:body - -
-
- -

Quickview

- -
    -
  • Use resource sets to create a localized app.
  • -
  • Android loads the correct resource set for the user's language and locale.
  • -
  • If localized resources are not available, Android loads your default resources.
  • -
- -

In this document

-
    -
  1. Overview: Resource-Switching in Android
  2. -
  3. Using Resources for Localization
  4. -
  5. Localization Tips
  6. -
  7. Testing Localized Applications
  8. -
- -

See also

-
    -
  1. Localization Checklist
  2. -
  3. Providing Resources
  4. -
  5. Layouts
  6. -
  7. Activity Lifecycle
  8. -
-
-
- -

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. -

- -

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.

- -

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.

- -

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:

- - - -

For a short guide to localizing strings in your app, see the training lesson, Supporting Different Languages.

- - -

Overview: Resource-Switching in Android

- -

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.

- -

(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 Providing -Alternative Resources.)

- - - - - - - -

- When you write your application: -

- You create a set of default resources, plus alternatives to be used in - different locales.

-

right-arrow

- When a user runs your application: -

The Android system selects which resources to load, based on the - device's locale.

- -

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 res/ directory. -

- - - -

Why Default Resources Are Important

- -

Whenever the application runs in a locale for which you have not provided -locale-specific text, Android will load the default strings from -res/values/strings.xml. 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.

- -

Example: -

An application's Java code refers to just two strings, text_a and - text_b. This application includes a localized resource file - (res/values-en/strings.xml) that defines text_a and - text_b in English. This application also includes a default - resource file (res/values/strings.xml) that includes a -definition for text_a, but not for text_b: -

- - -

To prevent this situation, make sure that a res/values/strings.xml - 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 - Testing for Default Resources.

- -

Using Resources for Localization

- -

How to Create Default Resources

- -

Put the application's default text in -a file with the following location and name:

-

    res/values/strings.xml (required directory)

- -

The text strings in res/values/strings.xml should use the -default language, which is the language that you expect most of your application's users to -speak.

- -

The default resource set must also include any default drawables and layouts, - and can include other types of resources such as animations. -
-     res/drawable/(required directory holding at least - one graphic file, for the application's icon on Google Play)
-     res/layout/ (required directory holding an XML - file that defines the default layout)
-     res/anim/ (required if you have any - res/anim-<qualifiers> folders)
-     res/xml/ (required if you have any - res/xml-<qualifiers> folders)
-     res/raw/ (required if you have any - res/raw-<qualifiers> folders) -

- -

Tip: 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 - localized string file can contain a subset of the strings, but the - default string file must contain them all. -

- -

How to Create Alternative Resources

- -

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.

- -

An application can specify many res/<qualifiers>/ -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 -Providing -Alternative Resources, -or else it will not compile.)

- -

Example:

- -

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 strings.xml -files, each stored in a locale-specific resource directory:

- -
    -
  1. res/values/strings.xml
    - Contains English text for all the strings that the application uses, -including text for a string named title.
  2. -
  3. res/values-fr/strings.xml
    - Contain French text for all the strings, including title.
  4. -
  5. res/values-ja/strings.xml
    - Contain Japanese text for all the strings except -title.
    -
  6. -
- -

If your Java code refers to R.string.title, here is what will -happen at runtime:

- - - -

Notice that if the device is set to Japanese, Android will look for -title in the res/values-ja/strings.xml file. But -because no such string is included in that file, Android will fall back to the -default, and will load title in English from the -res/values/strings.xml file.

- -

Which Resources Take Precedence?

- -

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, locale almost always takes -precedence.

-

Example:

- -

Assume that an application includes a default set of graphics and two other -sets of graphics, each optimized for a different device setup:

- - - -

If the application runs on a device that is configured to use Japanese, -Android will load graphics from res/drawable-ja/, even if the -device happens to be one that expects input from a stylus and has a QVGA -low-density screen in landscape orientation.

- -

Exception: The only qualifiers that take -precedence over locale in the selection process are MCC and MNC (mobile country -code and mobile network code).

- -

Example:

- -

Assume that you have the following situation:

- - - -

Android will load text_a from -res/values-mcc404/strings.xml (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.

- -

The selection process is not always as straightforward as these examples -suggest. Please read How Android Finds -the Best-matching Resource for a more nuanced description of the -process. All the qualifiers are described and listed in order of -precedence in Table 2 of Providing -Alternative Resources.

- -

Referring to Resources in Java

- -

In your application's Java code, you refer to resources using the syntax -R.resource_type.resource_name or -android.R.resource_type.resource_name. -For more about this, see Accessing Resources.

- -

Localization Checklist

- -

For a complete overview of the process of localizing and distributing an Android application, -see the Localization -Checklist document.

- -

Localization Tips

- -

Design your application to work in any locale

- -

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.

- -

Important: Make sure that your application -includes a full set of default resources.

Make sure to include -res/drawable/ and a res/values/ folders (without any -additional modifiers in the folder names) that contain all the images and text -that your application will need.

- -

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 - res/values/strings.xml default file might lack one string that - the application needs: When the application runs in an unsupported locale and - attempts to load res/values/strings.xml, 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.

- -

For more information, see Testing for Default Resources.

- -

Design a flexible layout

- -

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 res/layout-de/main.xml). However, doing this -can make your application harder to maintain. It is better to create a single -layout that is more flexible.

- -

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:

- - - -

Avoid creating more resource files and text strings than you need

- -

You probably do not need to create a locale-specific -alternative for every resource in your application. For example, the layout -defined in the res/layout/main.xml file might work in any locale, -in which case there would be no need to create any alternative layout files. -

- -

Also, you might not need to create alternative text for every -string. For example, assume the following:

- - - -

To do this, you could create a small file called -res/values-en-rGB/strings.xml 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 res/values/strings.xml.

- -

Use the Android Context object for manual locale lookup

- -

You can look up the locale using the {@link android.content.Context} object -that Android makes available:

- -
String locale = context.getResources().getConfiguration().locale.getDisplayName();
- -

Testing Localized Applications

- -

Testing on a Device

-

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.

- -

To change the locale or language on a device, use the Settings application.

- -

Testing on an Emulator

- -

For details about using the emulator, see See Android Emulator.

-

Creating and using a custom locale

- -

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 SDK 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:

- - - -

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.

- -

Changing the emulator locale from the adb shell

- -

To change the locale in the emulator by using the adb shell.

- -
    -
  1. Pick the locale you want to test and determine its BCP-47 language tag, for -example, Canadian French would be fr-CA.
    -
  2. -
  3. Launch an emulator.
  4. -
  5. From a command-line shell on the host computer, run the following -command:
    - adb shell
    - or if you have a device attached, specify that you want the emulator by adding -the -e option:
    - adb -e shell
  6. -
  7. At the adb shell prompt (#), run this command:
    - setprop persist.sys.locale [BCP-47 language tag];stop;sleep 5;start
    -
    Replace bracketed sections with the appropriate codes from Step -1.
  8. -
- -

For instance, to test in Canadian French:

- -

setprop persist.sys.locale fr-CA;stop;sleep 5;start

- -

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.

- -

Testing for Default Resources

-

Here's how to test whether an application includes every string resource that it needs:

-
  1. Set the emulator or device to a language that your application does not - support. For example, if the application has French strings in - res/values-fr/ but does not have any Spanish strings in - res/values-es/, then set the emulator's locale to Spanish. - (You can use the Custom Locale application to set the emulator to an - unsupported locale.)
  2. -
  3. Run the application.
  4. -
  5. 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 - res/values/strings.xml file includes a definition for - every string that the application uses.
  6. -
-

- -

If the test is successful, repeat it for other types of - configurations. For example, if the application has a layout file called - res/layout-land/main.xml but does not contain a file called - res/layout-port/main.xml, 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 + +

+
+ +

Quickview

+ +
    +
  • Use resource sets to create a localized app.
  • +
  • Android loads the correct resource set for the user's language and locale.
  • +
  • If localized resources are not available, Android loads your default resources.
  • +
+ +

In this document

+
    +
  1. Overview: Resource-Switching in Android
  2. +
  3. Using Resources for Localization
  4. +
  5. Localization Tips
  6. +
  7. Testing Localized Applications
  8. +
+ +

See also

+
    +
  1. Localization Checklist
  2. +
  3. Providing Resources
  4. +
  5. Layouts
  6. +
  7. Activity Lifecycle
  8. +
+
+
+ +

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. +

+ +

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.

+ +

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.

+ +

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:

+ + + +

For a short guide to localizing strings in your app, see the training lesson, Supporting Different Languages.

+ + +

Overview: Resource-Switching in Android

+ +

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.

+ +

(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 Providing +Alternative Resources.)

+ + + + + + + +

+ When you write your application: +

+ You create a set of default resources, plus alternatives to be used in + different locales.

+

right-arrow

+ When a user runs your application: +

The Android system selects which resources to load, based on the + device's locale.

+ +

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 res/ directory. +

+ + + +

Why Default Resources Are Important

+ +

Whenever the application runs in a locale for which you have not provided +locale-specific text, Android will load the default strings from +res/values/strings.xml. 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.

+ +

Example: +

An application's Java code refers to just two strings, text_a and + text_b. This application includes a localized resource file + (res/values-en/strings.xml) that defines text_a and + text_b in English. This application also includes a default + resource file (res/values/strings.xml) that includes a +definition for text_a, but not for text_b: +

+ + +

To prevent this situation, make sure that a res/values/strings.xml + 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 + Testing for Default Resources.

+ +

Using Resources for Localization

+ +

How to Create Default Resources

+ +

Put the application's default text in +a file with the following location and name:

+

    res/values/strings.xml (required directory)

+ +

The text strings in res/values/strings.xml should use the +default language, which is the language that you expect most of your application's users to +speak.

+ +

The default resource set must also include any default drawables and layouts, + and can include other types of resources such as animations. +
+     res/drawable/(required directory holding at least + one graphic file, for the application's icon on Google Play)
+     res/layout/ (required directory holding an XML + file that defines the default layout)
+     res/anim/ (required if you have any + res/anim-<qualifiers> folders)
+     res/xml/ (required if you have any + res/xml-<qualifiers> folders)
+     res/raw/ (required if you have any + res/raw-<qualifiers> folders) +

+ +

Tip: 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 + localized string file can contain a subset of the strings, but the + default string file must contain them all. +

+ +

How to Create Alternative Resources

+ +

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.

+ +

An application can specify many res/<qualifiers>/ +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 +Providing +Alternative Resources, +or else it will not compile.)

+ +

Example:

+ +

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 strings.xml +files, each stored in a locale-specific resource directory:

+ +
    +
  1. res/values/strings.xml
    + Contains English text for all the strings that the application uses, +including text for a string named title.
  2. +
  3. res/values-fr/strings.xml
    + Contain French text for all the strings, including title.
  4. +
  5. res/values-ja/strings.xml
    + Contain Japanese text for all the strings except +title.
    +
  6. +
+ +

If your Java code refers to R.string.title, here is what will +happen at runtime:

+ + + +

Notice that if the device is set to Japanese, Android will look for +title in the res/values-ja/strings.xml file. But +because no such string is included in that file, Android will fall back to the +default, and will load title in English from the +res/values/strings.xml file.

+ +

Which Resources Take Precedence?

+ +

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, locale almost always takes +precedence.

+

Example:

+ +

Assume that an application includes a default set of graphics and two other +sets of graphics, each optimized for a different device setup:

+ + + +

If the application runs on a device that is configured to use Japanese, +Android will load graphics from res/drawable-ja/, even if the +device happens to be one that expects input from a stylus and has a QVGA +low-density screen in landscape orientation.

+ +

Exception: The only qualifiers that take +precedence over locale in the selection process are MCC and MNC (mobile country +code and mobile network code).

+ +

Example:

+ +

Assume that you have the following situation:

+ + + +

Android will load text_a from +res/values-mcc404/strings.xml (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.

+ +

The selection process is not always as straightforward as these examples +suggest. Please read How Android Finds +the Best-matching Resource for a more nuanced description of the +process. All the qualifiers are described and listed in order of +precedence in Table 2 of Providing +Alternative Resources.

+ +

Referring to Resources in Java

+ +

In your application's Java code, you refer to resources using the syntax +R.resource_type.resource_name or +android.R.resource_type.resource_name. +For more about this, see Accessing Resources.

+ +

Localization Checklist

+ +

For a complete overview of the process of localizing and distributing an Android application, +see the Localization +Checklist document.

+ +

Localization Tips

+ +

Design your application to work in any locale

+ +

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.

+ +

Important: Make sure that your application +includes a full set of default resources.

Make sure to include +res/drawable/ and a res/values/ folders (without any +additional modifiers in the folder names) that contain all the images and text +that your application will need.

+ +

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 + res/values/strings.xml default file might lack one string that + the application needs: When the application runs in an unsupported locale and + attempts to load res/values/strings.xml, 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.

+ +

For more information, see Testing for Default Resources.

+ +

Design a flexible layout

+ +

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 res/layout-de/main.xml). However, doing this +can make your application harder to maintain. It is better to create a single +layout that is more flexible.

+ +

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:

+ + + +

Avoid creating more resource files and text strings than you need

+ +

You probably do not need to create a locale-specific +alternative for every resource in your application. For example, the layout +defined in the res/layout/main.xml file might work in any locale, +in which case there would be no need to create any alternative layout files. +

+ +

Also, you might not need to create alternative text for every +string. For example, assume the following:

+ + + +

To do this, you could create a small file called +res/values-en-rGB/strings.xml 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 res/values/strings.xml.

+ +

Use the Android Context object for manual locale lookup

+ +

You can look up the locale using the {@link android.content.Context} object +that Android makes available:

+ +
String locale = context.getResources().getConfiguration().locale.getDisplayName();
+ +

Testing Localized Applications

+ +

Testing on a Device

+

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.

+ +

To change the locale or language on a device, use the Settings application.

+ +

Testing on an Emulator

+ +

For details about using the emulator, see See Android Emulator.

+

Creating and using a custom locale

+ +

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 SDK 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:

+ + + +

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.

+ +

Changing the emulator locale from the adb shell

+ +

To change the locale in the emulator by using the adb shell.

+ +
    +
  1. Pick the locale you want to test and determine its BCP-47 language tag, for +example, Canadian French would be fr-CA.
    +
  2. +
  3. Launch an emulator.
  4. +
  5. From a command-line shell on the host computer, run the following +command:
    + adb shell
    + or if you have a device attached, specify that you want the emulator by adding +the -e option:
    + adb -e shell
  6. +
  7. At the adb shell prompt (#), run this command:
    + setprop persist.sys.locale [BCP-47 language tag];stop;sleep 5;start
    +
    Replace bracketed sections with the appropriate codes from Step +1.
  8. +
+ +

For instance, to test in Canadian French:

+ +

setprop persist.sys.locale fr-CA;stop;sleep 5;start

+ +

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.

+ +

Testing for Default Resources

+

Here's how to test whether an application includes every string resource that it needs:

+
  1. Set the emulator or device to a language that your application does not + support. For example, if the application has French strings in + res/values-fr/ but does not have any Spanish strings in + res/values-es/, then set the emulator's locale to Spanish. + (You can use the Custom Locale application to set the emulator to an + unsupported locale.)
  2. +
  3. Run the application.
  4. +
  5. 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 + res/values/strings.xml file includes a definition for + every string that the application uses.
  6. +
+

+ +

If the test is successful, repeat it for other types of + configurations. For example, if the application has a layout file called + res/layout-land/main.xml but does not contain a file called + res/layout-port/main.xml, then set the emulator or device to + portrait orientation and see if the application will run. + + + diff --git a/docs/overview-ext.html b/docs/overview-ext.html index 57202452fc73e..f80d629633a03 100644 --- a/docs/overview-ext.html +++ b/docs/overview-ext.html @@ -1,8 +1,8 @@ - -Some random libraries that we've imported: -

- + +Some random libraries that we've imported: + + diff --git a/location/java/android/location/INetInitiatedListener.aidl b/location/java/android/location/INetInitiatedListener.aidl index f2f5a32f70984..fc64dd67c1166 100644 --- a/location/java/android/location/INetInitiatedListener.aidl +++ b/location/java/android/location/INetInitiatedListener.aidl @@ -1,26 +1,26 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - -package android.location; - -/** - * {@hide} - */ -interface INetInitiatedListener -{ - boolean sendNiResponse(int notifId, int userResponse); -} +/* +** +** Copyright 2008, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +package android.location; + +/** + * {@hide} + */ +interface INetInitiatedListener +{ + boolean sendNiResponse(int notifId, int userResponse); +} diff --git a/tests/LocationTracker/src/com/android/locationtracker/SettingsActivity.java b/tests/LocationTracker/src/com/android/locationtracker/SettingsActivity.java index cb77118fc0c62..a169b1899e9ac 100644 --- a/tests/LocationTracker/src/com/android/locationtracker/SettingsActivity.java +++ b/tests/LocationTracker/src/com/android/locationtracker/SettingsActivity.java @@ -1,35 +1,35 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.locationtracker; - -import android.os.Bundle; -import android.preference.PreferenceActivity; - -/** - * Settings preference screen for location tracker - */ -public class SettingsActivity extends PreferenceActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Load the preferences from an XML resource - addPreferencesFromResource(R.xml.preferences); - } - -} +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.locationtracker; + +import android.os.Bundle; +import android.preference.PreferenceActivity; + +/** + * Settings preference screen for location tracker + */ +public class SettingsActivity extends PreferenceActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.preferences); + } + +} diff --git a/tests/LocationTracker/src/com/android/locationtracker/data/TrackerListHelper.java b/tests/LocationTracker/src/com/android/locationtracker/data/TrackerListHelper.java index 55d4d1ef760a9..adc39b33d9435 100644 --- a/tests/LocationTracker/src/com/android/locationtracker/data/TrackerListHelper.java +++ b/tests/LocationTracker/src/com/android/locationtracker/data/TrackerListHelper.java @@ -1,75 +1,75 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.android.locationtracker.data; - -import android.app.ListActivity; -import android.content.Context; -import android.database.Cursor; -import android.view.View; -import android.widget.ResourceCursorAdapter; -import android.widget.TextView; - -import com.android.locationtracker.R; - -/** - * Used to bind Tracker data to a list view UI - */ -public class TrackerListHelper extends TrackerDataHelper { - - private ListActivity mActivity; - - // sort entries by most recent first - private static final String SORT_ORDER = TrackerEntry.ID_COL + " DESC"; - - public TrackerListHelper(ListActivity activity) { - super(activity, TrackerDataHelper.CSV_FORMATTER); - mActivity = activity; - } - - /** - * Helper method for binding the list activities UI to the tracker data - * Tracker data will be sorted in most-recent first order - * Will enable automatic UI changes as tracker data changes - * - * @param layout - layout to populate data - */ - public void bindListUI(int layout) { - Cursor cursor = mActivity.managedQuery(TrackerProvider.CONTENT_URI, - TrackerEntry.ATTRIBUTES, null, null, SORT_ORDER); - // Used to map tracker entries from the database to views - TrackerAdapter adapter = new TrackerAdapter(mActivity, layout, cursor); - mActivity.setListAdapter(adapter); - cursor.setNotificationUri(mActivity.getContentResolver(), - TrackerProvider.CONTENT_URI); - - } - - private class TrackerAdapter extends ResourceCursorAdapter { - - public TrackerAdapter(Context context, int layout, Cursor c) { - super(context, layout, c); - } - - @Override - public void bindView(View view, Context context, Cursor cursor) { - final TextView v = (TextView) view - .findViewById(R.id.entrylist_item); - String rowText = mFormatter.getOutput(TrackerEntry - .createEntry(cursor)); - v.setText(rowText); - } - } -} +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.android.locationtracker.data; + +import android.app.ListActivity; +import android.content.Context; +import android.database.Cursor; +import android.view.View; +import android.widget.ResourceCursorAdapter; +import android.widget.TextView; + +import com.android.locationtracker.R; + +/** + * Used to bind Tracker data to a list view UI + */ +public class TrackerListHelper extends TrackerDataHelper { + + private ListActivity mActivity; + + // sort entries by most recent first + private static final String SORT_ORDER = TrackerEntry.ID_COL + " DESC"; + + public TrackerListHelper(ListActivity activity) { + super(activity, TrackerDataHelper.CSV_FORMATTER); + mActivity = activity; + } + + /** + * Helper method for binding the list activities UI to the tracker data + * Tracker data will be sorted in most-recent first order + * Will enable automatic UI changes as tracker data changes + * + * @param layout - layout to populate data + */ + public void bindListUI(int layout) { + Cursor cursor = mActivity.managedQuery(TrackerProvider.CONTENT_URI, + TrackerEntry.ATTRIBUTES, null, null, SORT_ORDER); + // Used to map tracker entries from the database to views + TrackerAdapter adapter = new TrackerAdapter(mActivity, layout, cursor); + mActivity.setListAdapter(adapter); + cursor.setNotificationUri(mActivity.getContentResolver(), + TrackerProvider.CONTENT_URI); + + } + + private class TrackerAdapter extends ResourceCursorAdapter { + + public TrackerAdapter(Context context, int layout, Cursor c) { + super(context, layout, c); + } + + @Override + public void bindView(View view, Context context, Cursor cursor) { + final TextView v = (TextView) view + .findViewById(R.id.entrylist_item); + String rowText = mFormatter.getOutput(TrackerEntry + .createEntry(cursor)); + v.setText(rowText); + } + } +}