diff options
Diffstat (limited to 'docs/html/guide/tutorials/views')
4 files changed, 31 insertions, 26 deletions
diff --git a/docs/html/guide/tutorials/views/hello-autocomplete.jd b/docs/html/guide/tutorials/views/hello-autocomplete.jd index de3ba29..fba1ad8 100644 --- a/docs/html/guide/tutorials/views/hello-autocomplete.jd +++ b/docs/html/guide/tutorials/views/hello-autocomplete.jd @@ -40,7 +40,7 @@ protected void onCreate(Bundle savedInstanceState) { AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, - android.R.layout.simple_dropdown_item_1line, R.array.planets); + android.R.layout.simple_dropdown_item_1line, COUNTRIES); textView.setAdapter(adapter); } </pre> diff --git a/docs/html/guide/tutorials/views/hello-formstuff.jd b/docs/html/guide/tutorials/views/hello-formstuff.jd index f858ce3..da4289c 100644 --- a/docs/html/guide/tutorials/views/hello-formstuff.jd +++ b/docs/html/guide/tutorials/views/hello-formstuff.jd @@ -32,7 +32,7 @@ We'll make it display a message when pressed.</p> <ol> <li><img src="images/android.png" align="right"/> Drag the Android image on the right (or your own image) into the - res/drawables/ directory of your project. + res/drawable/ directory of your project. We'll use this for the button.</li> <li>Open the layout file and, inside the LinearLayout, add the {@link android.widget.ImageButton} element: <pre> @@ -43,7 +43,7 @@ We'll make it display a message when pressed.</p> android:src="@drawable/android" /> </pre> <p>The source of the button - is from the res/drawables/ directory, where we've placed the android.png.</p> + is from the res/drawable/ directory, where we've placed the android.png.</p> <p class="note"><strong>Tip:</strong> You can also reference some of the many built-in images from the Android {@link android.R.drawable} resources, like <code>ic_media_play</code>, for a "play" button image. To do so, change the source @@ -52,7 +52,7 @@ We'll make it display a message when pressed.</p> <li>To make the button to actually do something, add the following code at the end of the <code>onCreate()</code> method: <pre> -ImageButton button = (ImageButton) findViewById(R.id.android_button); +final ImageButton button = (ImageButton) findViewById(R.id.android_button); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks @@ -84,12 +84,12 @@ defines the action to be made when the button is clicked. Here, we show a <li>To do something with the text that the user enters, add the following code to the end of the <code>onCreate()</code> method: <pre> -EditText edittext = (EditText) findViewById(R.id.edittext); +final EditText edittext = (EditText) findViewById(R.id.edittext); edittext.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on key press - Toast.makeText(HelloImageButton.this, edittext.getText(), Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, edittext.getText(), Toast.LENGTH_SHORT).show(); return true; } return false; @@ -127,9 +127,9 @@ checkbox.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks if (checkbox.isChecked()) { - Toast.makeText(HelloImageButton.this, "Selected", Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, "Selected", Toast.LENGTH_SHORT).show(); } else { - Toast.makeText(HelloImageButton.this, "Not selected", Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, "Not selected", Toast.LENGTH_SHORT).show(); } } }); @@ -183,7 +183,7 @@ OnClickListener radio_listener = new OnClickListener() { public void onClick(View v) { // Perform action on clicks RadioButton rb = (RadioButton) v; - Toast.makeText(HelloImageButton.this, rb.getText(), Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, rb.getText(), Toast.LENGTH_SHORT).show(); } }; </pre> @@ -225,9 +225,9 @@ togglebutton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks if (togglebutton.isChecked()) { - Toast.makeText(HelloImageButton.this, "ON", Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, "ON", Toast.LENGTH_SHORT).show(); } else { - Toast.makeText(HelloImageButton.this, "OFF", Toast.LENGTH_SHORT).show(); + Toast.makeText(HelloFormStuff.this, "OFF", Toast.LENGTH_SHORT).show(); } } }); diff --git a/docs/html/guide/tutorials/views/hello-gridview.jd b/docs/html/guide/tutorials/views/hello-gridview.jd index 623a03d..ffb6c93 100644 --- a/docs/html/guide/tutorials/views/hello-gridview.jd +++ b/docs/html/guide/tutorials/views/hello-gridview.jd @@ -25,6 +25,7 @@ are acquired from a {@link android.widget.ListAdapter}.</p> android:stretchMode="columnWidth" android:gravity="center" /> +</pre> </li> <li>Open the HelloGridView Java file. Insert the following for the <code>onCreate()</code> method: <pre> diff --git a/docs/html/guide/tutorials/views/hello-mapview.jd b/docs/html/guide/tutorials/views/hello-mapview.jd index b0f59de..976b8ab 100644 --- a/docs/html/guide/tutorials/views/hello-mapview.jd +++ b/docs/html/guide/tutorials/views/hello-mapview.jd @@ -16,8 +16,13 @@ First, we'll create a simple Activity that can view and navigate a map. Then we <pre><uses-library android:name="com.google.android.maps" /></pre> </li> - - <li>Open the layout file. Define the layout with a MapView inside a RelativeLayout: + <li>We also need access to the internet in order to retrieve the Google Maps tiles, + so the application must request the {@link android.Manifest.permission#INTERNET INTERNET} permissions. + In the manifest file, add the following as a child of the <code><manifest></code> element: + <pre><uses-permission android:name="android.permission.INTERNET" /></pre> + </li> + <li>Now open the main layout file for your project. Define a layout with a com.google.android.maps.MapView + inside a android.widget.RelativeLayout: <pre> <?xml version="1.0" encoding="utf-8"?> @@ -32,22 +37,21 @@ First, we'll create a simple Activity that can view and navigate a map. Then we android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" - android:apiKey="INSERT YOUR KEY HERE" + android:apiKey="<em>Your Maps API Key</em>" /> -<RelativeLayout> +</RelativeLayout> </pre> - <p>Setting <code>clickable</code> is important. Otherwise, the map does not allow any user interaction.</p> - - <p>The <code>android:apiKey</code> must contain an authentic Android Maps API key. - The API key is generated using the MD5 fingerprint of your application certificate. For the purposes of - this exercise, you should use the fingerprint of your debug certificate (which cannot be used to release - your application for Android devices, but will work while developing). See how to - <a href="{@docRoot}guide/topics/location/geo/mapkey.html#getdebugfingerprint">generate a fingerprint from your - debug certificate</a>, then <a href="http://code.google.com/android/maps-api-signup.html">register the - certificate</a> to retieve an API key. - Insert the API key as the value of the <code>apiKey</code> attribute. If you do not insert a valid - Maps API key, the application will still run, but no map tiles will load.</p></li> + <p>The <code>clickable</code> attribute defines whether you want to allow user-interaction with the map. + In this case, we set it "true" so that the user can navigate.</p> + + <p>The <code>apiKey</code> attribute holds the Google Maps API Key that proves your application and signer + certificate has been registered with the Google Maps service. Because MapView uses Google Maps data, this key is required + in order to receive the map data, even while you are developing. Registration is free and it only takes a couple + minutes to register your certificate and receive a Maps API Key. For instructions on getting a key, read + <a href="{@docRoot}guide/topics/location/geo/mapkey.html">Obtaining a Maps API Key</a>. + (For the purpose of this tutorial, you should register with the fingerprint of the SDK debug certificate.) + Once you've acquired the Maps API Key, insert it for the <code>apiKey</code> value.</p></li> <li>Now open the HelloMapView.java file. For this Activity, we're going to extend the special sub-class of Activity called MapActivity, so change the class declaration to extend |