diff options
author | Scott Main <smain@google.com> | 2011-05-16 13:54:02 -0700 |
---|---|---|
committer | Scott Main <smain@google.com> | 2011-05-16 13:54:02 -0700 |
commit | 7a701024be7e58f840ebf9636cdad62ee4606b72 (patch) | |
tree | aa77649fac59f70346fba251ec220b8f806ac504 /docs | |
parent | 904f48107e2843a1e255872afac8ddf8e9513ca4 (diff) | |
download | frameworks_base-7a701024be7e58f840ebf9636cdad62ee4606b72.zip frameworks_base-7a701024be7e58f840ebf9636cdad62ee4606b72.tar.gz frameworks_base-7a701024be7e58f840ebf9636cdad62ee4606b72.tar.bz2 |
docs: add redirects to key legacy docs
bug: 4439292
Change-Id: Ifd8f590504507fe417aae102a757cb7eae5507a3
Diffstat (limited to 'docs')
-rw-r--r-- | docs/html/community/index.html | 10 | ||||
-rw-r--r-- | docs/html/community/index.jd | 127 | ||||
-rw-r--r-- | docs/html/guide/samples/index.html | 10 | ||||
-rw-r--r-- | docs/html/guide/samples/index.jd | 15 | ||||
-rw-r--r-- | docs/html/guide/tutorials/hello-world.html | 10 | ||||
-rw-r--r-- | docs/html/guide/tutorials/hello-world.jd | 569 | ||||
-rw-r--r-- | docs/html/guide/tutorials/index.html | 6 | ||||
-rw-r--r-- | docs/html/guide/tutorials/localization/index.html | 10 | ||||
-rwxr-xr-x | docs/html/guide/tutorials/localization/index.jd | 593 | ||||
-rw-r--r-- | docs/html/guide/tutorials/notepad/index.html | 10 | ||||
-rw-r--r-- | docs/html/guide/tutorials/notepad/index.jd | 142 | ||||
-rw-r--r-- | docs/html/guide/tutorials/views/index.html | 10 | ||||
-rw-r--r-- | docs/html/guide/tutorials/views/index.jd | 118 |
13 files changed, 64 insertions, 1566 deletions
diff --git a/docs/html/community/index.html b/docs/html/community/index.html new file mode 100644 index 0000000..fb2a0d3 --- /dev/null +++ b/docs/html/community/index.html @@ -0,0 +1,10 @@ +<html> +<head> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/community-groups.html"> +<title>Redirecting...</title> +</head> +<body> +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/community-groups.html">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/community/index.jd b/docs/html/community/index.jd deleted file mode 100644 index 23203c1..0000000 --- a/docs/html/community/index.jd +++ /dev/null @@ -1,127 +0,0 @@ -community=true -page.title=Community -@jd:body - - <div id="mainBodyFluid"> -<h1>Community</h1> -<p>Welcome to the Android developers community! We're glad you're here and invite you to participate in these discussions. Before posting, please read the <a href="http://source.android.com/community/groups-charter.html">Groups Charter</a> that covers the community guidelines.</p> - -<p class="note"><strong>Note:</strong> If you are seeking discussion about Android source code (not application development), -then please refer to the <a href="http://source.android.com/community">Open Source Project Mailing lists</a>.</p> - -<p style="margin-bottom:.5em"><strong>Contents</strong></p> -<ol class="toc"> - <li><a href="#BeforeYouPost">Before you post</a></li> - <li><a href="#ApplicationDeveloperLists">Application developer mailing lists</a></li> - <li><a href="#UsingEmail">Using email with the mailing lists</a></li> - <li><a href="#UsingIRC">Using IRC</a></li> -</ol> - -<h2 id="BeforeYouPost">Before you post</h2> -<p>Before writing a post, please try the following:</p> - -<ol> -<li><a href="{@docRoot}guide/appendix/faq/index.html">Read the FAQs</a> The most common questions about developing Android applications are addressed in this frequently updated list.</li> -<li><strong>Type in keywords of your questions in the main Android site's search bar</strong> (such as the one above). This search encompasses all previous discussions, across all groups, as well as the full contents of the site, documentation, and blogs. Chances are good that somebody has run into the same issue before.</li> -<li><b>Search the mailing list archives</b> to see whether your questions have already been discussed. - </li> -</ol> - -<p>If you can't find your answer, then we encourage you to address the community. -As you write your post, please do the following: -<ol> -<li><b>Read -the <a href="http://source.android.com/community/groups-charter.html">mailing list charter</a></b> that covers the community guidelines. -</li> -<li><b>Select the most appropriate mailing list for your question</b>. There are several different lists for -developers, described below.</li> -<li> - <b>Be very clear</b> about your question -in the subject -- it helps everyone, both those trying to answer your -question as well as those who may be looking for information in the -future.</li> -<li><b>Give plenty of details</b> in your post to -help others understand your problem. Code or log snippets, as well as -pointers to screenshots, may also be helpful. For a great guide to -phrasing your questions, read <a href="http://www.catb.org/%7Eesr/faqs/smart-questions.html">How To Ask Questions The Smart Way</a>. - </li> -</ol> - - -<h3 id="ApplicationDeveloperLists">Application developer mailing lists</h3> -<ul> -<li><b>Android beginners</b> - You're new to Android application development. You want to figure out how to get started with the Android SDK and the basic Android APIs? Start here. This list is open to any discussion around beginner-type questions for developers using the SDK; this is a great way to get up and running with your new application on the Android platform. Ask about getting your development environment set up, get help with the first steps of Android development (your first User Interface, your first permission, your first file on the Android filesystem, your first app on the Android Market...). Be sure to check the archives first before asking new questions. Please avoid advanced subjects, which belong on android-developers, and user questions, which will get a better reception on android-discuss. -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-beginners">android-beginners</a></li> -<li>Subscribe via email: <a href="mailto:android-beginners-subscribe@googlegroups.com">android-beginners-subscribe@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android developers</b> - You're now an experienced Android application developer. You've grasped the basics of Android app development, you're comfortable using the SDK, now you want to move to advanced topics. Get help here with troubleshooting applications, advice on implementation, and strategies for improving your application's performance and user experience. This is the not the right place to discuss user issues (use android-discuss for that) or beginner questions with the Android SDK (use android-beginners for that). -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-developers">android-developers</a></li> -<li>Subscribe via email: <a href="mailto:android-developers-subscribe@googlegroups.com">android-developers-subscribe@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android discuss</b> - The "water cooler" of Android discussion. You can discuss just about anything Android-related here, ideas for the Android platform, announcements about your applications, discussions about Android devices, community resources... As long as your discussion is related to Android, it's on-topic here. However, if you have a discussion here that could belong on another list, you are probably not reaching all of your target audience here and may want to consider shifting to a more targeted list. -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-discuss">android-discuss</a></li> -<li>Subscribe via email: <a href="mailto:android-discuss-subscribe@googlegroups.com">android-discuss-subscribe@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android ndk</b> - A place for discussing the Android NDK and topics related to using native code in Android applications. -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-ndk">android-ndk</a></li> -<li>Subscribe via email: <a href="mailto:android-ndk-subscribe@googlegroups.com">android-ndk-subscribe@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android security discuss</b> - A place for open discussion on secure development, emerging security concerns, and best practices for and by android developers. Please don't disclose vulnerabilities directly on this list, you'd be putting all Android users at risk. -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-security-discuss">android-security-discuss</a></li> -<li>Subscribe via email: <a href="mailto:android-security-discuss@googlegroups.com">android-security-discuss@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android security announce</b> - A low-volume group for security-related announcements by the Android Security Team. -<ul> -<li>Subscribe using Google Groups: <a href="http://groups.google.com/group/android-security-announce">android-security-announce</a></li> -<li>Subscribe via email: <a href="mailto:android-security-announce-subscribe@googlegroups.com">android-security-announce-subscribe@googlegroups.com</a></li> -</ul> -</li> - -<li><b>Android Market Help Forum</b> - A web-based discussion forum where you can ask questions or report issues relating to Android Market. -<ul> -<li>URL: <a href="http://www.google.com/support/forum/p/Android+Market?hl=en">http://www.google.com/support/forum/p/Android+Market?hl=en</a></li> -</ul> -</li> - -</ul> - - - -<h2 id="UsingEmail">Using email with the mailing lists</h2> -<p>Instead of using the <a href="http://groups.google.com/">Google Groups</a> site, you can use your email client of choice to participate in the mailing lists.</p> -<p>To subscribe to a group without using the Google Groups site, use the link under "subscribe via email" in the lists above.</p> -<p>To set up how you receive mailing list postings by email:</p> - -<ol><li>Sign into the group via the Google Groups site. For example, for the android-framework group you would visit <a href="http://groups.google.com/group/android-framework">http://groups.google.com/group/android-framework</a>.</li> -<li>Click "Edit -my membership" on the right side.</li> -<li>Under "How do -you want to read this group?" select one of the email options. </li> -</ol> - -<h2 id="UsingIRC">Using IRC</h2> -<p>The Android community is using the #android channel on the irc.freenode.net server. -</p> - - - - - - - -</div> diff --git a/docs/html/guide/samples/index.html b/docs/html/guide/samples/index.html new file mode 100644 index 0000000..f4acdbf --- /dev/null +++ b/docs/html/guide/samples/index.html @@ -0,0 +1,10 @@ +<html> +<head> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/browser.html?tag=sample"> +<title>Redirecting...</title> +</head> +<body> +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/browser.html?tag=sample">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/guide/samples/index.jd b/docs/html/guide/samples/index.jd deleted file mode 100644 index 4b9334f..0000000 --- a/docs/html/guide/samples/index.jd +++ /dev/null @@ -1,15 +0,0 @@ -guide=true -page.title=Sample Code -@jd:body - - -<script type="text/javascript"> - window.location = toRoot + "resources/browser.html?tag=sample"; -</script> - -<p><strong>This document has moved. Please go to <a -href="http://developer.android.com/resources/browser.html?tag=sample">List of Sample -Apps</a>.</strong></p> - - - diff --git a/docs/html/guide/tutorials/hello-world.html b/docs/html/guide/tutorials/hello-world.html new file mode 100644 index 0000000..55187bd --- /dev/null +++ b/docs/html/guide/tutorials/hello-world.html @@ -0,0 +1,10 @@ +<html> +<head> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/tutorials/hello-world.html"> +<title>Redirecting...</title> +</head> +<body> +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/tutorials/hello-world.html">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/guide/tutorials/hello-world.jd b/docs/html/guide/tutorials/hello-world.jd deleted file mode 100644 index 11e6497..0000000 --- a/docs/html/guide/tutorials/hello-world.jd +++ /dev/null @@ -1,569 +0,0 @@ -page.title=Hello, World -@jd:body - -<div id="qv-wrapper"> - <div id="qv"> - <h2>In this document</h2> - <ol> - <li><a href="#avd">Create an AVD</a></li> - <li><a href="#create">Create the Project</a></li> - <li><a href="#ui">Construct the UI</a></li> - <li><a href="#run">Run the Code</a></li> - <li><a href="#upgrading">Upgrade the UI to an XML Layout</a></li> - <li><a href="#debugging">Debug Your Project</a></li> - <li><a href="#noeclipse">Creating the Project Without Eclipse</a></li> - </ol> - </div> -</div> - -<p>As a developer, you know that the first impression -of a development framework is how easy it is to write "Hello, -World." Well, on Android, it's pretty easy. -It's particularly easy if you're using Eclipse as your IDE, because we've provided a -great plugin that handles your project creation and management to greatly speed-up your -development cycles.</p> - -<p>If you are not using Eclipse, the tools provided by the Android SDK are accessible -on the command line, so you can choose your IDE or text editor. -For more information about developing with the Android SDK tools, see -the <a href="{@docRoot}guide/developing/index.html">Overview</a> -section for developing on Android.</p> - -<p>Before you start, you should already have the very latest SDK installed, and if you're using -Eclipse, you should have installed the ADT plugin as well. If you have not installed these, see -<a href="{@docRoot}sdk/installing.html">Installing the Android SDK</a> and return -here when you've completed the installation.</p> - -<h2 id="avd">Create an AVD</h2> - -<div class="sidebox-wrapper"> - <div class="sidebox"> - <p>To learn more about how to use AVDs and the options - available to you, refer to the - <a href="{@docRoot}guide/developing/tools/avd.html">Android - Virtual Devices</a> document.</p> - </div> -</div> - -<p>In this tutorial, you will run your application in the Android Emulator. -Before you can launch the emulator, you must create an -Android Virtual Device (AVD). An AVD defines the system image and -device settings used by the emulator.</p> - -<p>To create an AVD, use the "android" tool provided in the Android SDK. -Open a command prompt or terminal, navigate to the -<code>tools/</code> directory in the SDK package and execute: -<pre> -android create avd --target 2 --name my_avd -</pre> - -<p>The tool now asks if you would like to create a custom hardware profile. -For the time being, press Return to skip it ("no" is the default response). -That's it. This configures an AVD named "my_avd" that uses the Android 1.5 -platform. The AVD is now ready for use in the emulator.</p> - -<p>In the above command, the <code>--target</code> option is required -and specifies the deployment target to run on the emulator. -The <code>--name</code> option is also required and defines the -name for the new AVD.</p> - - -<h2 id="create">Create a New Android Project</h2> - -<p>After you've created an AVD, the next step is to start a new -Android project in Eclipse.</p> - -<ol> - <li>From Eclipse, select <strong>File > New > Project</strong>. - <p>If the ADT - Plugin for Eclipse has been successfully installed, the resulting dialog - should have a folder labeled "Android" which should contain - "Android Project". (After you create one or more Android projects, an entry for - "Android XML File" will also be available.)</p> - </li> - - <li>Select "Android Project" and click <strong>Next</strong>.<br/> - <a href="images/hello_world_0.png"><img src="images/hello_world_0.png" style="height:230px" alt="" /></a> - </li> - - <li>Fill in the project details with the following values: - <ul> - <li><em>Project name:</em> HelloAndroid</li> - <li><em>Application name:</em> Hello, Android</li> - <li><em>Package name:</em> com.example.helloandroid (or your own private namespace)</li> - <li><em>Create Activity:</em> HelloAndroid</li> - <li><em>Min SDK Version:</em> 2</li> - </ul> - <p>Click <strong>Finish</strong>.</p> - - <a href="images/hello_world_1.png"><img src="images/hello_world_1.png" style="height:230px" alt="" /></a> - - <p>Here is a description of each field:</p> - - <dl> - <dt><em>Project Name</em></dt> - <dd>This is the Eclipse Project name — the name of the directory - that will contain the project files.</dd> - <dt><em>Application Name</em></dt> - <dd>This is the human-readable title for your application — the name that - will appear on the Android device.</dd> - <dt><em>Package Name</em></dt> - <dd>This is the package namespace (following the same rules as for - packages in the Java programming language) that you want all your source code to - reside under. This also sets the package name under which the stub - Activity will be generated. - <p>Your package name must be unique across - all packages installed on the Android system; for this reason, it's very - important to use a standard domain-style package for your - applications. The example above uses the "com.example" namespace, which is - a namespace reserved for example documentation — - when you develop your own applications, you should use a namespace that's - appropriate to your organization or entity.</p></dd> - <dt><em>Create Activity</em></dt> - <dd>This is the name for the class stub that will be generated by the plugin. - This will be a subclass of Android's {@link android.app.Activity} class. An - Activity is simply a class that can run and do work. It can create a UI if it - chooses, but it doesn't need to. As the checkbox suggests, this is optional, but an - Activity is almost always used as the basis for an application.</dd> - <dt><em>Min SDK Version</em></dt> - <dd>This value specifies the minimum API Level required by your application. If the API Level - entered here matches the API Level provided by one of the available targets, - then that Build Target will be automatically selected (in this case, entering - "2" as the API Level will select the Android 1.1 target). With each new - version of the Android system image and Android SDK, there have likely been - additions or changes made to the APIs. When this occurs, a new API Level is assigned - to the system image to regulate which applications are allowed to be run. If an - application requires an API Level that is <em>higher</em> than the level supported - by the device, then the application will not be installed.</dd> - </dl> - - <p><em>Other fields</em>: The checkbox for "Use default location" allows you to change - the location on disk where the project's files will be generated and stored. "Build Target" - is the platform target that your application will be compiled against - (this should be selected automatically, based on your Min SDK Version).</p> - - <p class="note">Notice that the "Build Target" you've selected uses the Android 1.1 - platform. This means that your application will be compiled against the Android 1.1 - platform library. If you recall, the AVD created above runs on the Android 1.5 platform. - These don't have to match; Android applications are forward-compatible, so an application - built against the 1.1 platform library will run normally on the 1.5 platform. The reverse - is not true.</p> - </li> -</ol> - -<p>Your Android project is now ready. It should be visible in the Package -Explorer on the left. -Open the <code>HelloAndroid.java</code> file, located inside <em>HelloAndroid > src > -com.example.helloandroid</em>). It should look like this:</p> - -<pre> -package com.example.helloandroid; - -import android.app.Activity; -import android.os.Bundle; - -public class HelloAndroid extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } -}</pre> - -<p>Notice that the class is based on the {@link android.app.Activity} class. An Activity is a -single application entity that is used to perform actions. An application may have many separate -activities, but the user interacts with them one at a time. The -{@link android.app.Activity#onCreate(Bundle) onCreate()} method -will be called by the Android system when your Activity starts — -it is where you should perform all initialization and UI setup. An activity is not required to -have a user interface, but usually will.</p> - -<p>Now let's modify some code! </p> - - -<h2 id="ui">Construct the UI</h2> - -<p>Take a look at the revised code below and then make the same changes to your HelloAndroid class. -The bold items are lines that have been added.</p> - -<pre> -package com.android.helloandroid; - -import android.app.Activity; -import android.os.Bundle; -<strong>import android.widget.TextView;</strong> - -public class HelloAndroid extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - <strong>TextView tv = new TextView(this); - tv.setText("Hello, Android"); - setContentView(tv);</strong> - } -}</pre> - -<p class="note"><strong>Tip:</strong> An easy way to add import packages to your project is -to press <strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac). This is an Eclipse -shortcut that identifies missing packages based on your code and adds them for you.</p> - -<p>An Android user interface is composed of hierarchies of objects called -Views. A {@link android.view.View} is a drawable object used as an element in your UI layout, -such as a button, image, or (in this case) a text label. Each of these objects is a subclass -of the View class and the subclass that handles text is {@link android.widget.TextView}.</p> - -<p>In this change, you create a TextView with the class constructor, which accepts -an Android {@link android.content.Context} instance as its parameter. A -Context is a handle to the system; it provides services like -resolving resources, obtaining access to databases and preferences, and so -on. The Activity class inherits from Context, and because your -HelloAndroid class is a subclass of Activity, it is also a Context. So, you can -pass <code>this</code> as your Context reference to the TextView.</p> - -<p>Next, you define the text content with -{@link android.widget.TextView setText(CharSequence) setText()}.</p> - -<p>Finally, you pass the TextView to -{@link android.app.Activity#setContentView(View) setContentView()} in order to -display it as the content for the Activity UI. If your Activity doesn't -call this method, then no UI is present and the system will display a blank -screen.</p> - -<p>There it is — "Hello, World" in Android! The next step, of course, is -to see it running.</p> - - -<h2 id="run">Run the Application</h2> - -<p>The Eclipse plugin makes it very easy to run your applications:</p> - -<ol> - <li>Select <strong>Run > Run</strong>.</li> - <li>Select "Android Application".</li> -</ol> - -<div class="sidebox-wrapper"> - <div class="sidebox"> - <p>To learn more about creating and editing run configurations in Eclipse, refer to - <a href="{@docRoot}guide/developing/eclipse-adt.html#RunConfig">Developing In Eclipse, - with ADT</a>.</p> - </div> -</div> - -<p>The Eclipse ADT will automatically create a new run configuration for your project -and the Android Emulator will automatically launch. Once the emulator is booted up, -your application will appear after a moment. You should now see something like this:</p> - - <a href="images/hello_world_5.png"><img src="images/hello_world_5.png" style="height:230px" alt="" /></a> - -<p>The "Hello, Android" you see in the grey bar is actually the application title. The Eclipse plugin -creates this automatically (the string is defined in the <code>res/values/strings.xml</code> file and referenced -by your <code>AndroidManifest.xml</code> file). The text below the title is the actual text that you have -created in the TextView object.</p> - -<p>That concludes the basic "Hello World" tutorial, but you should continue reading for some more -valuable information about developing Android applications.</p> - - -<h2 id="upgrading">Upgrade the UI to an XML Layout</h2> - -<p>The "Hello, World" example you just completed uses what is called a "programmatic" -UI layout. This means that you constructed and built your application's UI -directly in source code. If you've done much UI programming, you're -probably familiar with how brittle that approach can sometimes be: small -changes in layout can result in big source-code headaches. It's also very -easy to forget to properly connect Views together, which can result in errors in -your layout and wasted time debugging your code.</p> - -<p>That's why Android provides an alternate UI construction model: XML-based -layout files. The easiest way to explain this concept is to show an -example. Here's an XML layout file that is identical in behavior to the -programmatically-constructed example:</p> - -<pre><?xml version="1.0" encoding="utf-8"?> -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:text="@string/hello"/></pre> - -<p>The general structure of an Android XML layout file is simple: it's a tree -of XML elements, wherein each node is the name of a View class -(this example, however, is just one View element). You can use the -name of any class that extends {@link android.view.View} as an element in your XML layouts, -including custom View classes you define in your own code. This -structure makes it very easy to quickly build up UIs, using a more simple -structure and syntax than you would use in a programmatic layout. This model is inspired -by the web development model, wherein you can separate the presentation of your -application (its UI) from the application logic used to fetch and fill in data.</p> - -<p>In the above XML example, there's just one View element: the <code>TextView</code>, -which has four XML attributes. Here's a summary of what they mean:</p> - -<table> - <tbody> - <tr> - <th> - Attribute - </th> - <th> - Meaning - </th> - </tr> - <tr> - <td> - <code>xmlns:android</code> - </td> - <td> - This is an XML namespace declaration that tells the Android tools that you are going to refer to common attributes defined in the Android namespace. The outermost tag in every Android layout file must have this attribute.<br> - </td> - </tr> - <tr> - <td> - <code>android:layout_width</code> - </td> - <td> - This attribute defines how much of the available width on the screen this View should consume. -In this case, it's the only View so you want it to take up the entire screen, which is what a value of "fill_parent" means.<br> - </td> - </tr> - <tr> - <td> - <code>android:layout_height</code> - </td> - <td> - This is just like android:layout_width, except that it refers to available screen height. - </td> - </tr> - <tr> - <td> - <code>android:text</code> - </td> - <td> - This sets the text that the TextView should display. In this example, you use a string - resource instead of a hard-coded string value. - The <em>hello</em> string is defined in the <em>res/values/strings.xml</em> file. This is the - recommended practice for inserting strings to your application, because it makes the localization - of your application to other languages graceful, without need to hard-code changes to the layout file. - For more information, see <a href="{@docRoot}guide/topics/resources/resources-i18n.html">Resources - and Internationalization</a>. - </td> - </tr> - </tbody> -</table> - - -<p>These XML layout files belong in the <code>res/layout/</code> directory of your project. The "res" is -short for "resources" and the directory contains all the non-code assets that -your application requires. In addition to layout files, resources also include assets -such as images, sounds, and localized strings.</p> - -<div class="sidebox-wrapper"> -<div class="sidebox"> - <h2>Landscape layout</h2> - <p>When you want a different design for landscape, put your layout XML file - inside /res/layout-land. Android will automatically look here when the layout changes. - Without this special landscape layout defined, Android will stretch the default layout.</p> -</div> -</div> - -<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml. -In the "Hello World" application you just completed, this file was ignored and you created a -layout programmatically. This was meant to teach you more -about the Android framework, but you should almost always define your layout -in an XML file instead of in your code. -The following procedures will instruct you how to change your -existing application to use an XML layout.</p> - -<ol> - <li>In the Eclipse Package Explorer, expand the -<code>/res/layout/</code> folder and open <code>main.xml</code> (once opened, you might need to click -the "main.xml" tab at the bottom of the window to see the XML source). Replace the contents with -the following XML: - -<pre><?xml version="1.0" encoding="utf-8"?> -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:text="@string/hello"/></pre> -<p>Save the file.</p> -</li> - -<li>Inside the <code>res/values/</code> folder, open <code>strings.xml</code>. -This is where you should save all default text strings for your user interface. If you're using Eclipse, then -ADT will have started you with two strings, <em>hello</em> and <em>app_name</em>. -Revise <em>hello</em> to something else. Perhaps "Hello, Android! I am a string resource!" -The entire file should now look like this: -<pre> -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="hello">Hello, Android! I am a string resource!</string> - <string name="app_name">Hello, Android</string> -</resources> -</pre> -</li> - -<li>Now open and modify your <code>HelloAndroid</code> class use the -XML layout. Edit the file to look like this: -<pre> -package com.example.helloandroid; - -import android.app.Activity; -import android.os.Bundle; - -public class HelloAndroid extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } -}</pre> - -<p>When you make this change, type it by hand to try the -code-completion feature. As you begin typing "R.layout.main" the plugin will offer you -suggestions. You'll find that it helps in a lot of situations.</p> - -<p>Instead of passing <code>setContentView()</code> a View object, you give it a reference -to the layout resource. -The resource is identified as <code>R.layout.main</code>, which is actually a compiled object representation of -the layout defined in <code>/res/layout/main.xml</code>. The Eclipse plugin automatically creates this reference for -you inside the project's R.java class. If you're not using Eclipse, then the R.java class will be generated for you -when you run Ant to build the application. (More about the R class in a moment.)</p> -</li> -</ol> - -<p>Now re-run your application — because you've created a launch configuration, all -you need to do is click the green arrow icon to run, or select -<strong>Run > Run History > Android Activity</strong>. Other than the change to the TextView -string, the application looks the same. After all, the point was to show that the two different -layout approaches produce identical results.</p> - -<p class="note"><strong>Tip:</strong> Use the shortcut <strong>Ctrl-F11</strong> -(<strong>Cmd-Shift-F11</strong>, on Mac) to run your currently visible application.</p> - -<p>Continue reading for an introduction -to debugging and a little more information on using other IDEs. When you're ready to learn more, -read <a href="{@docRoot}guide/topics/fundamentals.html">Application -Fundamentals</a> for an introduction to all the elements that make Android applications work. -Also refer to the <a href="{@docRoot}guide/index.html">Developer's Guide</a> -introduction page for an overview of the <em>Dev Guide</em> documentation.</p> - - -<div class="special"> -<h3>R class</h3> -<p>In Eclipse, open the file named <code>R.java</code> (in the <code>gen/</code> [Generated Java Files] folder). -It should look something like this:</p> - -<pre> -package com.example.helloandroid; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int icon=0x7f020000; - } - public static final class layout { - public static final int main=0x7f030000; - } - public static final class string { - public static final int app_name=0x7f040001; - public static final int hello=0x7f040000; - } -} -</pre> - -<p>A project's <code>R.java</code> file is an index into all the resources defined in the -file. You use this class in your source code as a sort of short-hand -way to refer to resources you've included in your project. This is -particularly powerful with the code-completion features of IDEs like Eclipse -because it lets you quickly and interactively locate the specific reference -you're looking for.</p> - -<p>It's possible yours looks slighly different than this (perhaps the hexadecimal values are different). -For now, notice the inner class named "layout", and its -member field "main". The Eclipse plugin noticed the XML -layout file named main.xml and generated a class for it here. As you add other -resources to your project (such as strings in the <code>res/values/string.xml</code> file or drawables inside -the <code>res/drawable/</code> direcory) you'll see <code>R.java</code> change to keep up.</p> -<p>When not using Eclipse, this class file will be generated for you at build time (with the Ant tool).</p> -<p><em>You should never edit this file by hand.</em></p> -</div> - -<h2 id="debugging">Debug Your Project</h2> - -<p>The Android Plugin for Eclipse also has excellent integration with the Eclipse -debugger. To demonstrate this, introduce a bug into -your code. Change your HelloAndroid source code to look like this:</p> - -<pre> -package com.android.helloandroid; - -import android.app.Activity; -import android.os.Bundle; - -public class HelloAndroid extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Object o = null; - o.toString(); - setContentView(R.layout.main); - } -}</pre> - -<p>This change simply introduces a NullPointerException into your code. If -you run your application again, you'll eventually see this:</p> - - <a href="images/hello_world_8.png"><img src="images/hello_world_8.png" style="height:230px" alt="" /></a> - -<p>Press "Force Quit" to terminate the application and close the emulator window.</p> - -<p>To find out more about the error, set a breakpoint in your source code -on the line <code>Object o = null;</code> (double-click on the marker bar next to the source code line). Then select <strong>Run > Debug History > Hello, -Android</strong> from the menu to enter debug mode. Your app will restart in the -emulator, but this time it will suspend when it reaches the breakpoint you -set. You can then step through the code in Eclipse's Debug Perspective, -just as you would for any other application.</p> - - <a href="images/hello_world_9.png"><img src="images/hello_world_9.png" style="height:230px" alt="" /></a> - - -<h2 id="noeclipse">Creating the Project without Eclipse</h2> - - <p>If you don't use Eclipse (such as if you prefer another IDE, or simply use text - editors and command line tools) then the Eclipse plugin can't help you. - Don't worry though — you don't lose any functionality just because you don't - use Eclipse.</p> - - <p>The Android Plugin for Eclipse is really just a wrapper around a set of tools - included with the Android SDK. (These tools, like the emulator, aapt, adb, - ddms, and others are <a href="{@docRoot}guide/developing/tools/index.html">documented elsewhere.</a>) - Thus, it's possible to - wrap those tools with another tool, such as an 'ant' build file.</p> - - <p>The Android SDK includes a tool named "android" that can be - used to create all the source code and directory stubs for your project, as well - as an ant-compatible <code>build.xml</code> file. This allows you to build your project - from the command line, or integrate it with the IDE of your choice.</p> - - <p>For example, to create a HelloAndroid project similar to the one created - in Eclipse, use this command:</p> - - <pre> -android create project \ - --package com.android.helloandroid \ - --activity HelloAndroid \ - --target 2 \ - --path <em><path-to-your-project></em>/HelloAndroid -</pre> - - <p>This creates the required folders and files for the project at the location - defined by the <em>path</em>.</p> - - <p>For more information on how to use the SDK tools to create and build projects on the command line, read -<a href="{@docRoot}guide/developing/projects/index.html">Creating and Managing Projects on the Command Line</a> and -<a href="{@docRoot}guide/developing/building/building-cmdline.html">Building and Running Apps on the Command Line</a>.</p> diff --git a/docs/html/guide/tutorials/index.html b/docs/html/guide/tutorials/index.html index 4881acf..e412dec 100644 --- a/docs/html/guide/tutorials/index.html +++ b/docs/html/guide/tutorials/index.html @@ -1,8 +1,10 @@ <html> <head> -<meta http-equiv="refresh" content="0;url=../index.html"> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/browser.html?tag=tutorial"> +<title>Redirecting...</title> </head> <body> -<a href="../index.html">click here</a> if you are not redirected. +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/browser.html?tag=tutorial">click here</a>.</p> </body> </html>
\ No newline at end of file diff --git a/docs/html/guide/tutorials/localization/index.html b/docs/html/guide/tutorials/localization/index.html new file mode 100644 index 0000000..2ea6661 --- /dev/null +++ b/docs/html/guide/tutorials/localization/index.html @@ -0,0 +1,10 @@ +<html>
+<head>
+<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/tutorials/localization/index.html">
+<title>Redirecting...</title>
+</head>
+<body>
+<p>You should have been redirected. Please <a
+href="http://developer.android.com/resources/tutorials/localization/index.html">click here</a>.</p>
+</body>
+</html>
\ No newline at end of file diff --git a/docs/html/guide/tutorials/localization/index.jd b/docs/html/guide/tutorials/localization/index.jd deleted file mode 100755 index 8a60814..0000000 --- a/docs/html/guide/tutorials/localization/index.jd +++ /dev/null @@ -1,593 +0,0 @@ -page.title=Hello, L10N
-@jd:body
-
-<div id="qv-wrapper">
- <div id="qv">
- <h2>In this document</h2>
- <ol>
- <li><a href="#unlocalized">Create an Unlocalized App</a>
- <ol>
- <li><a href="#create">Create the Project and Layout</a></li>
- <li><a href="#default">Create Default Resources</a></li>
- </ol>
- </li>
- <li><a href="#run">Run the Unlocalized App</a></li>
- <li><a href="#plan">Plan the Localization</a></li>
- <li><a href="#localize">Localize the App</a>
- <ol>
- <li><a href="#localize_strings">Localize the Strings</a></li>
- <li><a href="#localize_images">Localize the Images</a></li>
- </ol>
- </li>
- <li><a href="#test_localized">Run and Test the Localized App</a></li>
- </ol>
- <h2>See also</h2>
- <ol>
-<li>{@link android.widget.Button}</li>
-<li>{@link android.widget.TextView}</li>
-<li>{@link android.app.AlertDialog}</li>
-</ol>
- </div>
-</div>
-
-<p>In this tutorial, we will create a Hello, L10N application that uses the
-Android framework to selectively load resources. Then we will localize the
-application by adding resources to the <code>res/</code> directory. </p>
-
-<p>This tutorial uses the practices described in the <a
-href="{@docRoot}guide/topics/resources/localization.html">Localization</a>
-document. </p>
-
-
-<h2 id="unlocalized">Create an Unlocalized Application</h2>
-
-<p>The first version of the Hello, L10N application will use only the default
-resource directories (<code>res/drawable</code>, <code>res/layout</code>, and
-<code>res/values</code>). These resources are not localized — they are the
-graphics, layout, and strings that we expect the application to use most often.
-When a user runs the application in the default locale, or in a locale that the
-application does not specifically support, the application will load resources
-from these default directories.</p>
-
-<p>The application consists of a simple user interface that displays two
-{@link android.widget.TextView} objects and a {@link android.widget.Button} image with a
- background image of a national flag. When clicked, the button displays an
-{@link android.app.AlertDialog} object that shows additional text. </p>
-
-<h3 id="create">Create the Project and Layout</h3>
-
-<p>For this application, the default language will be British English and the
-default location the United Kingdom. </p>
-
-<ol>
- <li>Start a new project and Activity called "HelloL10N." If you are
-using Eclipse, fill out these values in the New Android Project wizard:
- <ul>
- <li><em>Project name:</em> HelloL10N</li>
- <li><em>Application name:</em> Hello, L10N</li>
- <li><em>Package name:</em> com.example.hellol10n (or your own private
-namespace)</li>
- <li><em>Create Activity:</em> HelloL10N</li>
- <li><em>Min SDK Version:</em> 3</li>
- </ul>
- <p>The basic project contains a <code>res/</code> directory with
-subdirectories for the three most common types of resources: graphics
-(<code>res/drawable/</code>), layouts (<code>res/layout/</code>) and strings
-(<code>res/values/</code>). Most of the localization work you do later in this
-tutorial will involve adding more subdirectories to the <code>res/</code>
-directory.</p>
- <img src="{@docRoot}images/hello_l10n/plain_project.png" alt="plain project" width="194"
-height="229">
- </li>
- <li>Open the <code>res/layout/main.xml</code> file and replace it with the
-following code:
- <pre><?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:text="@string/text_a"
- />
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:text="@string/text_b"
- />
-<Button
- android:id="@+id/flag_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- />
-</LinearLayout>
- </pre>
-
- <p>The LinearLayout has two {@link android.widget.TextView} objects that will
-display localized text and one {@link android.widget.Button} that shows a flag.
-</p>
- </li>
-</ol>
-
-<h3 id="default">Create Default Resources</h3>
-
-<p>The layout refers to resources that need to be defined. </p>
-
-<ol>
- <li>Create default text strings. To do this, open the <code>res/values/strings.xml</code> file and replace it with the following code:<br>
- <pre><?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">Hello, L10N</string>
- <string name="text_a">Shall I compare thee to a summer"'"s day?</string>
- <string name="text_b">Thou art more lovely and more temperate.</string>
- <string name="dialog_title">No Localisation</string>
- <string name="dialog_text">This dialog box"'"s strings are not localised. For every locale, the text here will come from values/strings.xml.</string>
-</resources></pre>
-
- <p>This code provides British English text for each string that the application
-will use. When we localize this application, we will provide alternate text in
-German, French, and Japanese for some of the strings.</p>
- </li>
- <li>Add a default flag graphic to the <code>res/drawable</code> folder by
-saving <a href="../../../images/hello_l10n/flag.png">flag.png</a> as
-<code>res/drawable/flag.png</code>. When the application is not localized, it
-will show a British flag.<br>
-
- </li>
- <li>Open HelloL10N.java (in the <code>src/</code> directory) and add the
-following code inside the <code>onCreate()</code> method (after
-<code>setContentView</code>).
-
- <pre>// assign flag.png to the button, loading correct flag image for current locale
-Button b;
-(b = (Button)findViewById(R.id.flag_button)).setBackgroundDrawable(this.getResources().getDrawable(R.drawable.flag));
-
-// build dialog box to display when user clicks the flag
-AlertDialog.Builder builder = new AlertDialog.Builder(this);
-builder.setMessage(R.string.dialog_text)
- .setCancelable(false)
- .setTitle(R.string.dialog_title)
- .setPositiveButton("Done", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.dismiss();
- }
- });
-final AlertDialog alert = builder.create();
-
-// set click listener on the flag to show the dialog box
-b.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- alert.show();
- }
- });</pre>
-
- <p class="note"><strong>Tip:</strong> In Eclipse, use
-<strong>Ctrl-Shift-O</strong> (<strong>Cmd-Shift-O</strong>, on Mac) to find and
-add missing import packages to your project, then save the HelloL10N.java
-file.</p>
-
- <p>The code that you added does the following:</p>
-
- <ul>
- <li>It assigns the correct flag icon to the button.
- For now, no resources are defined other than the default, so this code
-will always assign the contents of <code>res/drawable/flag.png</code> (the
-British flag) as the flag icon, no matter what the locale. Once we add more
-flags for different locales, this code will sometimes assign a different flag.
-</li>
- <li>It creates an {@link android.app.AlertDialog} object and sets a click listener so that when the
-user clicks the button, the AlertDialog will display.
- We will not localize the dialog text;
-the AlertDialog will always display the <code>dialog_text</code> that is located
-within <code>res/values/strings.xml</code>. </li>
- </ul>
-
- </li>
-</ol>
-
-<p>The project structure now looks like this:</p>
-
- <img src="{@docRoot}images/hello_l10n/nonlocalized_project.png" alt="nonlocalized" width="394"
-height="320">
-
-<p class="note"><strong>Tip:</strong> If you will want to run the application on
-a device and not just on an emulator, open <code>AndroidManifest.xml</code> and
-add <code>android:debuggable="true"</code> inside the
-<code><application></code> element. For information about setting up the
-device itself so it can run applications from your system, see <a
-href="{@docRoot}guide/developing/device.html">Developing on a Device</a>.</p>
-
-
-<h2 id="run">Run the Unlocalized Application</h2>
-
-<p>Save the project and run the application to see how it works. No matter what
-locale your device or emulator is set to, the application runs the same way. It
-should look something like this:</p>
-
-<table border="0" cellspacing="0" cellpadding="30">
- <tr>
- <th scope="col">The unlocalized application, running in any locale:</th>
- <th scope="col">After clicking the flag, in any locale:</th>
- </tr>
- <tr>
- <td valign="top"><img src="{@docRoot}images/hello_l10n/nonlocalized_screenshot1.png"
-alt="nonlocalized" width="321" height="366"></td>
- <td><img src="{@docRoot}images/hello_l10n/nonlocalized_screenshot2.png" alt="nonlocalized2"
-width="321" height="366"></td>
- </tr>
-</table>
-<h2 id="plan">Plan the Localization</h2>
-<p>The first step in localizing an application is to plan how the application
-will render differently in different locales. In this application, the default
-locale will be the United Kingdom. We will add some locale-specific information
-for Germany, France, Canada, Japan, and the United States. Table 1 shows the
-plan for how the application will appear in different locales.</p>
-
-<p class="caption">Table 1</p>
-
-<table border="0" cellspacing="0" cellpadding="10">
- <tr>
- <th scope="col" valign="bottom">Region /<br />
- Language</th>
- <th scope="col">United Kingdom</th>
- <th scope="col">Germany</th>
- <th scope="col">France</th>
- <th scope="col">Canada</th>
- <th scope="col">Japan</th>
- <th scope="col">United States</th>
- <th scope="col">Other Location</th>
- </tr>
- <tr>
- <th scope="row"><br>
- English</th>
- <td> British English text; British flag <em>(default)</em></td>
- <td><em>-</em></td>
- <td><em>-</em></td>
- <td> British English text; Canadian flag</td>
- <td>-</td>
- <td> British English text; U.S. flag</td>
- <td> British English text; British flag <em>(default)</em></td>
- </tr>
- <tr>
- <th scope="row">German</th>
- <td>-</td>
- <td>German text for <code>app_name</code>, <code>text_a</code> and
-<code>text_b</code>; German flag</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>German text for <code>app_name</code>, <code>text_a</code> and
-<code>text_b</code>; British flag</td>
- </tr>
- <tr>
- <th scope="row">French</th>
- <td>-</td>
- <td>-</td>
- <td>French text for <code>app_name</code>, <code>text_a</code> and
-<code>text_b</code>; French flag</td>
- <td>French text for <code>app_name</code>, <code>text_a</code> and
-<code>text_b</code>; Canadian flag</td>
- <td>-</td>
- <td>-</td>
- <td>French text for <code>app_name</code>, <code>text_a</code> and
-<code>text_b</code>; British flag</td>
- </tr>
- <tr>
- <th scope="row">Japanese</th>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>Japanese text for <code>text_a</code> and <code>text_b</code>; Japanese
-flag</td>
- <td>-</td>
- <td>Japanese text for <code>text_a</code> and <code>text_b</code>; British
-flag</td>
- </tr>
- <tr>
- <th scope="row">Other Language</th>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td> British English text; British flag <em>(default)</em></td>
- </tr>
-</table>
-
-<p class="note"> Note that other behaviors are possible; for example, the
-application could support Canadian English or U.S. English text. But given the
-small amount of text involved, adding more versions of English would not make
-this application more useful.</p>
-
-<p>As shown in the table above, the plan calls for five flag icons in addition
-to the British flag that is already in the <code>res/drawable/</code> folder. It
-also calls for three sets of text strings other than the text that is in
-<code>res/values/strings.xml</code>.</p>
-
-<p>Table 2 shows where the needed text strings and flag icons will go, and
-specifies which ones will be loaded for which locales. (For more about the
-locale codes, <em></em>see <a
-href="{@docRoot}guide/topics/resources/resources-i18n.html#AlternateResources">
-Alternate Resources</a>.)</p>
-<p class="caption" id="table2">Table 2</p>
-
-<table border="1" cellspacing="0" cellpadding="5">
- <tr>
- <th scope="col">Locale Code</th>
- <th scope="col">Language / Country</th>
- <th scope="col">Location of strings.xml</th>
- <th scope="col">Location of flag.png</th>
- </tr>
- <tr>
- <td><em>Default</em></td>
- <td>English / United Kingdom</td>
- <td>res/values/</td>
- <td>res/drawable/</td>
- </tr>
- <tr>
- <td>de-rDE</td>
- <td>German / Germany</td>
- <td>res/values-de/</td>
- <td>res/drawable-de-rDE/</td>
- </tr>
- <tr>
- <td>fr-rFR</td>
- <td>French / France</td>
- <td>res/values-fr/</td>
- <td>res/drawable-fr-rFR/</td>
- </tr>
- <tr>
- <td>fr-rCA</td>
- <td>French / Canada</td>
- <td>res/values-fr/</td>
- <td>res/drawable-fr-rCA/</td>
- </tr>
- <tr>
- <td>en-rCA</td>
- <td>English / Canada</td>
- <td><em>(res/values/)</em></td>
- <td>res/drawable-en-rCA/</td>
- </tr>
- <tr>
- <td>ja-rJP</td>
- <td>Japanese / Japan</td>
- <td>res/values-ja/</td>
- <td>res/drawable-ja-rJP/</td>
- </tr>
- <tr>
- <td>en-rUS</td>
- <td>English / United States</td>
- <td><em>(res/values/)</em></td>
- <td>res/drawable-en-rUS/</td>
- </tr>
-</table>
-
-<p class="note"><strong>Tip: </strong>A folder qualifer cannot specify a region
-without a language. Having a folder named <code>res/drawable-rCA/</code>,
-for example, will prevent the application from compiling. </p>
-
-<p>At run time, the application will select a set of resources to load based on the locale
-that is set in the user's device. In cases where no locale-specific resources
-are available, the application will fall back on the defaults. </p>
-
-<p>For example, assume that the device's language is set to German and its
-location to Switzerland. Because this application does not have a
-<code>res/drawable-de-rCH/</code> directory with a <code>flag.png</code> file in it, the system
-will fall back on the default, which is the UK flag located in
-<code>res/drawable/flag.png</code>. The language used will be German. Showing a
-British flag to German speakers in Switzerland is not ideal, but for now we will
-just leave the behavior as it is. There are several ways you could improve this
-application's behavior if you wanted to:</p>
-
-<ul>
- <li>Use a generic default icon. In this application, it might be something
-that represents Shakespeare. </li>
- <li>Create a <code>res/drawable-de/</code> folder that includes an icon that
-the application will use whenever the language is set to German but the location
-is not Germany. </li>
-</ul>
-
-
-<h2 id="localize">Localize the Application</h2>
-
-<h3 id="localize_strings">Localize the Strings</h3>
-
-<p>The application requires three more <code>strings.xml</code> files, one
-each for German, French, and Japanese. To create these resource files within
-Eclipse:</p>
-
-<ol>
-<li>Select <strong>File</strong> > <strong>New</strong> > <strong>Android
-XML File</strong> to open the New Android XML File wizard. You can also open
-the wizard by clicking its icon in the toolbar:<br />
-<img src="{@docRoot}images/hello_l10n/xml_file_wizard_shortcut.png"
-alt="file_wizard_shortcut" width="297"
-height="90" style="margin:15px"></li>
- <li>Select L10N for the Project field, and type <code>strings.xml</code> into
-the File field. In the left-hand list, select Language, then click the right arrow.<br>
-<img src="{@docRoot}images/hello_l10n/xml_wizard1.png" alt="res_file_copy" width="335"
-height="406" style="margin:15px"></li>
- <li>Type <code>de</code> in the Language box and click Finish.<br>
- <img src="{@docRoot}images/hello_l10n/xml_wizard2.png" alt="res_file_copy" width="306"
-height="179">
-<p>A new file, <code>res/values-de/strings.xml</code>, now appears among the project
-files.</p></li>
-<li>Repeat the steps twice more, for the language codes <code>fr</code> and
- <code>ja</code>.
-Now the project includes these new skeleton files: <br />
- <code>res/<strong>values-de</strong>/strings.xml</code><br />
- <code>res/<strong>values-fr</strong>/strings.xml</code><br />
- <code>res/<strong>values-ja</strong>/strings.xml</code><br />
- </li>
- <li>Add localized text to the new files. To do
-this, open the <code>res/values-<em><qualifier></em>/strings.xml</code> files and
-replace the code as follows:</li>
-</ol>
-
-<table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <th scope="col">File</th>
- <th scope="col">Replace the contents with the following code:</th>
- </tr>
- <tr>
- <td><code>res/values-de/strings.xml</code></td>
- <td><pre><?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">Hallo, Lokalisierung</string>
- <string name="text_a">Soll ich dich einem Sommertag vergleichen,</string>
- <string name="text_b">Der du viel lieblicher und sanfter bist?</string>
-</resources></pre></td>
- </tr>
- <tr>
- <td><code>res/values-fr/strings.xml</code></td>
- <td><pre><?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">Bonjour, Localisation</string>
- <string name="text_a">Irai-je te comparer au jour d'été?</string>
- <string name="text_b">Tu es plus tendre et bien plus tempéré.</string>
-</resources> </pre></td>
- </tr>
- <tr>
- <td><code>res/values-ja/strings.xml</code></td>
- <td>
-<pre><?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="text_a">あなたをなにかにたとえるとしたら夏の一日でしょうか?</string>
- <string name="text_b">だがあなたはもっと美しく、もっとおだやかです。</string>
-</resources></pre></td>
- </tr>
-</table>
-
-<p class="note"><b>Tip:</b> In the
-<code>values-<em><qualifier></em>/strings.xml</code> files, you only need to
-include text for strings that are different from the default strings. For
-example, when the application runs on a device that is configured for Japanese,
-the plan is for <code>text_a</code> and <code>text_b</code> to be in Japanese
-while all the other text is in English, so
-<code>res/values-ja/strings.xml</code> only needs to include <code>text_a</code>
-and <code>text_b</code>.</p>
-
-<h3 id="localize_images">Localize the Images</h3>
-
-<p>As shown in <a href="#table2">Table 2</a>, the application needs six more
-drawable folders, each containing a <code>flag.png</code> icon. Add the needed
-icons and folders to your project:</p>
-
-<ol>
- <li>Save this <a href="../../../images/hello_l10n/drawable-de-rDE/flag.png">German flag icon</a>
-as <code>res/drawable-de-rDE/flag.png</code> in the application's project
-workspace.
- <p>For example:</p>
- <ol>
- <li>Click the link to open the flag image.</li>
- <li>Save the image in
-<code><em>your-workspace</em>/HelloL10N/res/drawable-de-rDE/</code> .</li>
- </ol>
- </li>
- <li>Save this <a href="../../../images/hello_l10n/drawable-fr-rFR/flag.png">French flag icon</a>
-as <code>res/drawable-fr-rFR/flag.png</code> in the application's project
-workspace. </li>
- <li>Save this <a href="../../../images/hello_l10n/drawable-fr-rCA/flag.png">Canadian flag icon</a>
-as <code>res/drawable-fr-rCA/flag.png</code> in the project workspace. </li>
- <li>Save the <a href="../../../images/hello_l10n/drawable-en-rCA/flag.png">Canadian flag icon</a>
-again, this time as <code>res/drawable-en-rCA/flag.png</code> in the project
-workspace. (Why not have just <em>one</em> folder that contains the Canadian
-flag? Because a folder qualifer cannot specify a region without a language.
-You cannot have a folder named <code>drawable-rCA/</code>; instead you must
-create two separate folders, one for each of the Canadian languages represented
-in the application.)</li>
- <li>Save this <a href="../../../images/hello_l10n/drawable-ja-rJP/flag.png">Japanese flag icon</a>
-as <code>res/drawable-ja-rJP/flag.png</code> in the project workspace. </li>
- <li>Save this <a href="../../../images/hello_l10n/drawable-en-rUS/flag.png">United States flag
-icon</a> as <code>res/drawable-en-rUS/flag.png</code> in the project workspace.
- </li>
-</ol>
-
-<p>If you are using Eclipse, refresh the project (F5). The new
-<code>res/drawable-<em><qualifier></em>/</code> folders should appear in the
-project view. </p>
-
-
-<h2 id="test_localized">Run and Test the Localized Application</h2>
-
-<p>Once you've added the localized string and image resources, you are ready to
- run the application and test its handling of them. To change the locale
- on a device or in the emulator, use the Settings
-application (Home > Menu > Settings > Locale & text > Select
-locale). Depending on how a device was configured, it might not offer any
-alternate locales via the Settings application, or might offer only a few. The
-emulator, on the other hand, will offer a selection of all the locales that are
-available in the Android system image. </p>
-
-<p>To set the emulator to a locale that is not available in the system image,
-use the Custom Locale application, which is available in the Application
-tab:</p>
-
-<p><img src="{@docRoot}images/hello_l10n/custom_locale_app.png" alt="custom locale app" width="163"
-height="158" style="margin-left:15px"></p>
-
-<p>To switch to a new locale, long-press a locale name:</p>
-
-<p><img src="{@docRoot}images/hello_l10n/using_custom_locale.png" alt="using custom locale"
-width="512" height="299" style="margin-left:15px"></p>
-
-<p>For a list of locales available on different versions of the Android platform,
-refer to the platform notes documents, listed under "Downloadable SDK Components"
-in the "SDK" tab. For example, <a
-href="{@docRoot}sdk/android-2.0.html#locs">Android 2.0 locales</a>.</p>
-
-<p>Run the application for each of the expected locales, plus one unexpected
-locale. Here are some of the results you should see:</p>
-
-<table border="0" cellspacing="0" cellpadding="05">
- <tr>
- <th scope="col">Locale</th>
- <th scope="col">Opening screen of application</th>
- </tr>
- <tr>
- <td>German / Germany
- <br />Specifically supported by the Hello, L10N application.</td>
- <td><img src="{@docRoot}images/hello_l10n/german_screenshot.png" alt="custom locale app"
-width="321" height="175" align="right"
-style="margin-left:10px;margin-right:20px"></td>
- </tr>
- <tr>
- <td>French / Canada
- <br />Specifically supported by the Hello, L10N application.</td>
- <td><img src="{@docRoot}images/hello_l10n/frenchCA_screenshot.png" alt="custom locale app"
-width="321" height="175" align="right"
-style="margin-left:10px;margin-right:20px"></td>
- </tr>
- <tr>
- <td>German / Switzerland
- <br />Only the language is specifically supported by
-the Hello, L10N application.</td>
- <td><img src="{@docRoot}images/hello_l10n/germanCH_screenshot.png" alt="custom locale app"
-width="321" height="175" align="right"
-style="margin-left:10px;margin-right:20px">`</td>
- </tr>
- <tr>
- <td>Japanese
- <br />Specifically supported by the Hello, L10N application.
- </td>
- <td><img src="{@docRoot}images/hello_l10n/japanese_screenshot.png" alt="custom locale app"
-width="321" height="220" align="right"
-style="margin-left:10px;margin-right:20px">`</td>
- </tr>
- <tr>
- <td>Romansh / Switzerland (custom locale <code>rm_CH</code>)
- <br />Not specifically supported by the Hello, L10N
-application, so the application uses the default resources.</td>
- <td><img src="{@docRoot}images/hello_l10n/romanshCH_screenshot.png" alt="custom locale app"
-width="321" height="175" align="right"
-style="margin-left:10px;margin-right:20px"></td>
- </tr>
-</table>
diff --git a/docs/html/guide/tutorials/notepad/index.html b/docs/html/guide/tutorials/notepad/index.html new file mode 100644 index 0000000..01e4d09 --- /dev/null +++ b/docs/html/guide/tutorials/notepad/index.html @@ -0,0 +1,10 @@ +<html> +<head> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/tutorials/notepad/index.html"> +<title>Redirecting...</title> +</head> +<body> +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/tutorials/notepad/index.html">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/guide/tutorials/notepad/index.jd b/docs/html/guide/tutorials/notepad/index.jd deleted file mode 100644 index f569314..0000000 --- a/docs/html/guide/tutorials/notepad/index.jd +++ /dev/null @@ -1,142 +0,0 @@ -page.title=Notepad Tutorial -@jd:body - - -<p>This tutorial on writing a notepad application gives you a "hands-on" introduction -to the Android framework and the tools you use to build applications on it. -Starting from a preconfigured project file, it guides you through the process of -developing a simple notepad application and provides concrete examples of how to -set up the project, develop the application logic and user interface, and then -compile and run the application. </p> - -<p>The tutorial presents the application development as a set of -exercises (see below), each consisting of several steps. You should follow -the steps in each exercise to gradually build and refine your -application. The exercises explain each step in detail and provide all the -sample code you need to complete the application. </p> - -<p>When you are finished with the tutorial, you will have created a functioning -Android application and will have learned many of the most important -concepts in Android development. If you want to add more complex features to -your application, you can examine the code in an alternative implementation -of a Note Pad application, in the -<a href="{@docRoot}resources/samples/index.html">Sample Code</a> section. </p> - - -<a name="who"></a> -<h2>Who Should Use this Tutorial</h2> - -<p>This tutorial is designed for experienced developers, especially those with -knowledge of the Java programming language. If you haven't written Java -applications before, you can still use the tutorial, but you might need to work -at a slower pace. </p> - -<p>Also note that this tutorial uses -the Eclipse development environment, with the Android plugin installed. If you -are not using Eclipse, you can follow the exercises and build the application, -but you will need to determine how to accomplish the Eclipse-specific -steps in your environment. </p> - -<a name="preparing"></a> -<h2>Preparing for the Exercises</h2> - -<p>The tutorial assumes that you have some familiarity with basic Android -application concepts and terminology. If you are not, you -should read <a href="{@docRoot}guide/topics/fundamentals.html">Application -Fundamentals</a> before continuing. </p> - -<p>This tutorial also builds on the introductory information provided in the -<a href="{@docRoot}resources/tutorials/hello-world.html">Hello World</a> -tutorial, which explains how to set up your Eclipse environment -for building Android applications. We recommend you complete the Hello World -tutorial before starting this one.</p> - -<p>To prepare for this lesson:</p> - -<ol> - <li>Download the <a href="codelab/NotepadCodeLab.zip">project - exercises archive (.zip)</a>.</li> - <li>Unpack the archive file to a suitable location on your machine.</li> - <li>Open the <code>NotepadCodeLab</code> folder.</li> -</ol> - -<p>Inside the <code>NotepadCodeLab</code> folder, you should see six project -files: <code>Notepadv1</code>, - <code>Notepadv2</code>, <code>Notepadv3</code>, - <code>Notepadv1Solution</code>, <code>Notepadv2Solution</code> - and <code>Notepadv3Solution</code>. The <code>Notepadv#</code> projects are -the starting points for each of the exercises, while the -<code>Notepadv#Solution</code> projects are the exercise - solutions. If you are having trouble with a particular exercise, you - can compare your current work against the exercise solution.</p> - -<a name="exercises"></a> -<h2> Exercises</h2> - - <p>The table below lists the tutorial exercises and describes the development -areas that each covers. Each exercise assumes that you have completed any -previous exercises.</p> - - <table border="0" style="padding:4px;spacing:2px;" summary="This -table lists the -tutorial examples and describes what each covers. "> - <tr> - <th width="120"><a href="{@docRoot}resources/tutorials/notepad/notepad-ex1.html">Exercise -1</a></th> - <td>Start here. Construct a simple notes list that lets the user add new notes but not -edit them. Demonstrates the basics of <code>ListActivity</code> and creating -and handling - menu options. Uses a SQLite database to store the notes.</td> - </tr> - <tr> - <th><a href="{@docRoot}resources/tutorials/notepad/notepad-ex2.html">Exercise 2</a></th> - <td>Add a second Activity to the -application. Demonstrates constructing a -new Activity, adding it to the Android manifest, passing data between the -activities, and using more advanced screen layout. Also shows how to -invoke another Activity to return a result, using -<code>startActivityForResult()</code>.</td> - </tr> - <tr> - <th><a href="{@docRoot}resources/tutorials/notepad/notepad-ex3.html">Exercise 3</a></th> - <td>Add handling of life-cycle events to -the application, to let it -maintain application state across the life cycle. </td> - </tr> - <tr> - <th><a href="{@docRoot}resources/tutorials/notepad/notepad-extra-credit.html">Extra -Credit</a></th> - <td>Demonstrates how to use the Eclipse -debugger and how you can use it to -view life-cycle events as they are generated. This section is optional but -highly recommended.</td> - </tr> -</table> - - -<a name="other"></a> -<h2>Other Resources and Further Learning</h2> -<ul> -<li>For a lighter but broader introduction to concepts not covered in the -tutorial, -take a look at <a href="{@docRoot}resources/faq/commontasks.html">Common Android Tasks</a>.</li> -<li>The Android SDK includes a variety of fully functioning sample applications -that make excellent opportunities for further learning. You can find the sample -applications in the <code>samples/</code> directory of your downloaded SDK, or browser them -here, in the <a href="{@docRoot}resources/samples/index.html">Sample Code</a> section.</li> -<li>This tutorial draws from the full Notepad application included in the -<code>samples/</code> directory of the SDK, though it does not match it exactly. -When you are done with the tutorial, -it is highly recommended that you take a closer look at this version of the Notepad -application, -as it demonstrates a variety of interesting additions for your application, -such as:</li> - <ul> - <li>Setting up a custom striped list for the list of notes.</li> - <li>Creating a custom text edit view that overrides the <code>draw()</code> - method to make it look like a lined notepad.</li> - <li>Implementing a full <code>ContentProvider</code> for notes.</li> - <li>Reverting and discarding edits instead of just automatically saving - them.</li> - </ul> -</ul> diff --git a/docs/html/guide/tutorials/views/index.html b/docs/html/guide/tutorials/views/index.html new file mode 100644 index 0000000..41d6796 --- /dev/null +++ b/docs/html/guide/tutorials/views/index.html @@ -0,0 +1,10 @@ +<html> +<head> +<meta http-equiv="refresh" content="0;url=http://developer.android.com/resources/tutorials/views/index.html"> +<title>Redirecting...</title> +</head> +<body> +<p>You should have been redirected. Please <a +href="http://developer.android.com/resources/tutorials/views/index.html">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/guide/tutorials/views/index.jd b/docs/html/guide/tutorials/views/index.jd deleted file mode 100644 index 4e76ab9..0000000 --- a/docs/html/guide/tutorials/views/index.jd +++ /dev/null @@ -1,118 +0,0 @@ -page.title=Hello, Views -@jd:body - -<style> -.view {float:left; margin:10px; font-size:120%; font-weight:bold;} -.view img {border:1px solid black; margin:5px 0 0; padding:5px;} -</style> - -<p>This collection of "Hello World"-style tutorials is designed -to get you quickly started with common Android Views and widgets. The aim is to let you copy and paste -these kinds of boring bits so you can focus on developing the code that makes your Android application rock. -Of course, we'll discuss some of the given code so that it all makes sense.</p> - -<p>Note that a certain amount of knowledge is assumed for these tutorials. If you haven't -completed the <a href="{@docRoot}resources/tutorials/hello-world.html">Hello, World</a> tutorial, -please do so—it will teach you many things you should know about basic -Android development and Eclipse features. More specifically, you should know:</p> -<ul> - <li>How to create a new Android project.</li> - <li>The basic structure of an Android project (resource files, layout files, etc.).</li> - <li>The essential components of an {@link android.app.Activity}.</li> - <li>How to build and run a project.</li> -</ul> -<p>Please, also notice that, in order to make these tutorials simple, some may -not convey the better Android coding practices. In particular, many of them -use hard-coded strings in the layout files—the better practice is to reference strings from -your strings.xml file.</p> -<p>With this knowledge, you're ready to begin, so take your pick.</p> - -<div> - -<div class="view"> -<a href="hello-linearlayout.html">LinearLayout</a><br/> -<a href="hello-linearlayout.html"><img src="images/hello-linearlayout.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-relativelayout.html">RelativeLayout</a><br/> -<a href="hello-relativelayout.html"><img src="images/hello-relativelayout.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-tablelayout.html">TableLayout</a><br/> -<a href="hello-tablelayout.html"><img src="images/hello-tablelayout.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-datepicker.html">DatePicker</a><br/> -<a href="hello-datepicker.html"><img src="images/hello-datepicker.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-timepicker.html">TimePicker</a><br/> -<a href="hello-timepicker.html"><img src="images/hello-timepicker.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-formstuff.html">Form Stuff</a><br/> -<a href="hello-formstuff.html"><img src="images/hello-formstuff.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-spinner.html">Spinner</a><br/> -<a href="hello-spinner.html"><img src="images/hello-spinner.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-autocomplete.html">AutoComplete</a><br/> -<a href="hello-autocomplete.html"><img src="images/hello-autocomplete.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-listview.html">ListView</a><br/> -<a href="hello-listview.html"><img src="images/hello-listview.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-gridview.html">GridView</a><br/> -<a href="hello-gridview.html"><img src="images/hello-gridview.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-gallery.html">Gallery</a><br/> -<a href="hello-gallery.html"><img src="images/hello-gallery.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-tabwidget.html">TabWidget</a><br/> -<a href="hello-tabwidget.html"><img src="images/hello-tabwidget.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-mapview.html">MapView</a><br/> -<a href="hello-mapview.html"><img src="images/hello-mapview.png" height="285" width="200" /></a> -</div> - -<div class="view"> -<a href="hello-webview.html">WebView</a><br/> -<a href="hello-webview.html"><img src="images/hello-webview.png" height="285" width="200" /></a> -</div> - -<!-- -TODO - -<div class="view"> -<a href="hello-popupwindow.html">PopupWindow<br/> -<img src="images/hello-popupwindow.png" height="285" width="200" /></a> -</div> -<div class="view"> -<a href="hello-tabhost.html">TabHost / TabWidget<br/> -<img src="images/hello-tabhost.png" height="285" width="200" /></a> -</div> -ProgressBar; RatingBar; FrameLayout - ---> - -<p class="note" style="clear:left"> -There are plenty more Views and widgets available. See the {@link android.view.View} class -for more on View layouts, and the {@link android.widget widget package} -for more useful widgets. And for more raw code samples, visit the -<a href="{@docRoot}guide/samples/ApiDemos/src/com/example/android/apis/view/index.html">Api Demos</a>. -These can also be found offline, in <code>/<sdk>/samples/ApiDemos</code>.</p> -</div> - |