From 420d97fbc8eb573c1e200e9d3d46668b00990e7a Mon Sep 17 00:00:00 2001 From: Ricardo Cervera Date: Wed, 12 Mar 2014 16:02:51 -0700 Subject: docs: Updated Building your First App tutorial. Bug: 13429905 -Updated default code in activities from ADT -Updated screenshots for ADT wizards when changed -Updated activity_ with fragment_ where required -Other minor changes Stage: http://quixote.mtv:8004/training/basics/firstapp/creating-project.html Patch: Removed border from the new ADT screenshots. Patch: Replaced device screenshots using an Android 4.4 device. Patch: Addressed Katie's comments. Change-Id: Ic0acf714b1b5913f1f82d6eafac53666a721dfe4 --- docs/html/training/basics/firstapp/building-ui.jd | 7 +- .../training/basics/firstapp/creating-project.jd | 8 +-- docs/html/training/basics/firstapp/running-app.jd | 2 +- .../training/basics/firstapp/starting-activity.jd | 76 +++++++++++++--------- 4 files changed, 54 insertions(+), 39 deletions(-) (limited to 'docs/html/training/basics') diff --git a/docs/html/training/basics/firstapp/building-ui.jd b/docs/html/training/basics/firstapp/building-ui.jd index 2615bee..179b3ac 100644 --- a/docs/html/training/basics/firstapp/building-ui.jd +++ b/docs/html/training/basics/firstapp/building-ui.jd @@ -75,16 +75,16 @@ content of the text field to another activity.

Create a Linear Layout

-

Open the activity_main.xml file from the res/layout/ +

Open the fragment_main.xml file from the res/layout/ directory.

Note: In Eclipse, when you open a layout file, you’re first shown the Graphical Layout editor. This is an editor that helps you build layouts using WYSIWYG tools. For this -lesson, you’re going to work directly with the XML, so click the activity_main.xml tab at +lesson, you’re going to work directly with the XML, so click the fragment_main.xml tab at the bottom of the screen to open the XML editor.

The BlankActivity template you chose when you created this project includes the -activity_main.xml file with a {@link +fragment_main.xml file with a {@link android.widget.RelativeLayout} root view and a {@link android.widget.TextView} child view.

First, delete the {@link android.widget.TextView <TextView>} element and change the {@link @@ -95,7 +95,6 @@ android:orientation} attribute and set it to "horizontal". The result looks like this:

-<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
diff --git a/docs/html/training/basics/firstapp/creating-project.jd b/docs/html/training/basics/firstapp/creating-project.jd
index 9516e37..50485db 100644
--- a/docs/html/training/basics/firstapp/creating-project.jd
+++ b/docs/html/training/basics/firstapp/creating-project.jd
@@ -120,8 +120,8 @@ devices.
     Finish.
 
 
-

Your Android project is now set up with some default files and you’re ready to begin -building the app. Continue to the next lesson.

+

Your Android project is now a basic "Hello World" app that contains some default files. +To run the app, continue to the next lesson.

@@ -155,8 +155,8 @@ and replace projects.

-

Your Android project is now set up with several default configurations and you’re ready to begin -building the app. Continue to the next lesson.

+

Your Android project is now a basic "Hello World" app that contains some default files. +To run the app, continue to the next lesson.

Tip: Add the platform-tools/ as well as the tools/ directory to your PATH environment variable.

diff --git a/docs/html/training/basics/firstapp/running-app.jd b/docs/html/training/basics/firstapp/running-app.jd index 999d399..23cedba 100644 --- a/docs/html/training/basics/firstapp/running-app.jd +++ b/docs/html/training/basics/firstapp/running-app.jd @@ -62,7 +62,7 @@ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code andro attributes. For your first app, it should look like this:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android" ... >
-    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
+    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
     ...
 </manifest>
 
diff --git a/docs/html/training/basics/firstapp/starting-activity.jd b/docs/html/training/basics/firstapp/starting-activity.jd index 712eabc..9aa25a3 100644 --- a/docs/html/training/basics/firstapp/starting-activity.jd +++ b/docs/html/training/basics/firstapp/starting-activity.jd @@ -45,7 +45,7 @@ starts a new activity when the user clicks the Send button.

Respond to the Send Button

-

To respond to the button's on-click event, open the activity_main.xml +

To respond to the button's on-click event, open the fragment_main.xml layout file and add the {@code android:onClick} attribute to the {@link android.widget.Button <Button>} element:

@@ -73,14 +73,6 @@ public void sendMessage(View view) { }
-

This requires that you import the {@link android.view.View} class:

-
-import android.view.View;
-
- -

Tip: In Eclipse, press Ctrl + Shift + O to import missing classes -(Cmd + Shift + O on Mac).

-

In order for the system to match this method to the method name given to {@code android:onClick}, the signature must be exactly as shown. Specifically, the method must:

@@ -111,6 +103,14 @@ an activity called {@code DisplayMessageActivity}:

Intent intent = new Intent(this, DisplayMessageActivity.class); +

This requires that you import the {@link android.content.Intent} class:

+
+import android.content.Intent;
+
+ +

Tip: In Eclipse, press Ctrl + Shift + O to import missing classes +(Cmd + Shift + O on Mac).

+

The constructor used here takes two parameters: