diff options
Diffstat (limited to 'docs/html/training/basics')
-rw-r--r-- | docs/html/training/basics/data-storage/databases.jd | 2 | ||||
-rw-r--r-- | docs/html/training/basics/firstapp/running-app.jd | 22 | ||||
-rw-r--r-- | docs/html/training/basics/firstapp/starting-activity.jd | 19 |
3 files changed, 38 insertions, 5 deletions
diff --git a/docs/html/training/basics/data-storage/databases.jd b/docs/html/training/basics/data-storage/databases.jd index 3a717dd..8b11983 100644 --- a/docs/html/training/basics/data-storage/databases.jd +++ b/docs/html/training/basics/data-storage/databases.jd @@ -288,7 +288,7 @@ String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LI // Specify arguments in placeholder order. String[] selelectionArgs = { String.valueOf(rowId) }; // Issue SQL statement. -db.delete(table_name, mySelection, selectionArgs); +db.delete(table_name, selection, selectionArgs); </pre> diff --git a/docs/html/training/basics/firstapp/running-app.jd b/docs/html/training/basics/firstapp/running-app.jd index 7866083..999d399 100644 --- a/docs/html/training/basics/firstapp/running-app.jd +++ b/docs/html/training/basics/firstapp/running-app.jd @@ -52,7 +52,27 @@ project:</p> <dd>The <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest file</a> describes the fundamental characteristics of the app and defines each of its components. You'll learn about various declarations in this file as you read more training -classes.</dd> +classes. + <p>One of the most important elements your manifest should include is the <a +href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code <uses-sdk>}</a> +element. This declares your app's compatibility with different Android versions using the <a +href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a> +and <a +href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code android:targetSdkVersion}</a> +attributes. For your first app, it should look like this:</p> +<pre> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" ... > + <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> + ... +</manifest> +</pre> +<p>You should always set the <a +href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code android:targetSdkVersion}</a> +as high as possible and test your app on the corresponding platform version. For more information, +read <a href="{@docRoot}training/basics/supporting-devices/platforms.html">Supporting Different +Platform Versions</a>.</p> + + </dd> <dt><code>src/</code></dt> <dd>Directory for your app's main source files. By default, it includes an {@link android.app.Activity} class that runs when your app is launched using the app icon.</dd> diff --git a/docs/html/training/basics/firstapp/starting-activity.jd b/docs/html/training/basics/firstapp/starting-activity.jd index 8943c9d..65f22901 100644 --- a/docs/html/training/basics/firstapp/starting-activity.jd +++ b/docs/html/training/basics/firstapp/starting-activity.jd @@ -249,16 +249,29 @@ you won't need it for this app so you can remove it.</li> Keep this one the way it is.</li> </ul> -<p>The class should look like this:</p> +<p>Because the {@link android.app.ActionBar} APIs are available only on {@link +android.os.Build.VERSION_CODES#HONEYCOMB} (API level 11) and higher, you must add a condition +around the {@link android.app.Activity#getActionBar()} method to check the current platform version. +Additionally, you must add the {@code @SuppressLint("NewApi")} tag to the +{@link android.app.Activity#onCreate onCreate()} method to avoid <a +href="{@docRoot}tools/help/lint.html">lint</a> errors.</p> + +<p>The {@code DisplayMessageActivity} class should now look like this:</p> <pre> public class DisplayMessageActivity extends Activity { + + @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); - // Show the Up button in the action bar. - getActionBar().setDisplayHomeAsUpEnabled(true); + + // Make sure we're running on Honeycomb or higher to use ActionBar APIs + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // Show the Up button in the action bar. + getActionBar().setDisplayHomeAsUpEnabled(true); + } } @Override |