Merge "docs: misc bug fixes. including important versioning fixes for first app class" into jb-mr1-dev
This commit is contained in:
@@ -93,7 +93,7 @@ href="{@docRoot}guide/topics/manifest/uses-permission-element.html"><code><us
|
|||||||
element as a child of <code><manifest></code>, as follows: </p>
|
element as a child of <code><manifest></code>, as follows: </p>
|
||||||
|
|
||||||
<p style="margin-left:2em;"><code><uses-permission
|
<p style="margin-left:2em;"><code><uses-permission
|
||||||
android:name="com.android.vending.CHECK_LICENSE"></code></p>
|
android:name="com.android.vending.CHECK_LICENSE" /></code></p>
|
||||||
|
|
||||||
<p>For example, here's how the LVL sample application declares the permission:
|
<p>For example, here's how the LVL sample application declares the permission:
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ sources as your working set. If you are using a source-code management
|
|||||||
system, add and track the sources that are in the working location rather
|
system, add and track the sources that are in the working location rather
|
||||||
than those in default location in the SDK. </p>
|
than those in default location in the SDK. </p>
|
||||||
|
|
||||||
<p>Moving the library sources is important is because, when you later update the
|
<p>Moving the library sources is important because when you later update the
|
||||||
Licensing package, the SDK installs the new files to the same location as
|
Licensing package, the SDK installs the new files to the same location as
|
||||||
the older files. Moving your working library files to a safe location ensures
|
the older files. Moving your working library files to a safe location ensures
|
||||||
that your work won't be inadvertently overwritten should you download a new
|
that your work won't be inadvertently overwritten should you download a new
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ YourInterface.Stub}) and declares all the methods from the {@code .aidl} file.</
|
|||||||
defines a few helper methods, most notably {@code asInterface()}, which takes an {@link
|
defines a few helper methods, most notably {@code asInterface()}, which takes an {@link
|
||||||
android.os.IBinder} (usually the one passed to a client's {@link
|
android.os.IBinder} (usually the one passed to a client's {@link
|
||||||
android.content.ServiceConnection#onServiceConnected onServiceConnected()} callback method) and
|
android.content.ServiceConnection#onServiceConnected onServiceConnected()} callback method) and
|
||||||
returns an instance of the stub interface. See the section <a href="#calling">Calling an IPC
|
returns an instance of the stub interface. See the section <a href="#Calling">Calling an IPC
|
||||||
Method</a> for more details on how to make this cast.</p>
|
Method</a> for more details on how to make this cast.</p>
|
||||||
|
|
||||||
<p>To implement the interface generated from the {@code .aidl}, extend the generated {@link
|
<p>To implement the interface generated from the {@code .aidl}, extend the generated {@link
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LI
|
|||||||
// Specify arguments in placeholder order.
|
// Specify arguments in placeholder order.
|
||||||
String[] selelectionArgs = { String.valueOf(rowId) };
|
String[] selelectionArgs = { String.valueOf(rowId) };
|
||||||
// Issue SQL statement.
|
// Issue SQL statement.
|
||||||
db.delete(table_name, mySelection, selectionArgs);
|
db.delete(table_name, selection, selectionArgs);
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,27 @@ project:</p>
|
|||||||
<dd>The <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest file</a> describes
|
<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
|
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
|
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>
|
<dt><code>src/</code></dt>
|
||||||
<dd>Directory for your app's main source files. By default, it includes an {@link
|
<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>
|
android.app.Activity} class that runs when your app is launched using the app icon.</dd>
|
||||||
|
|||||||
@@ -249,17 +249,30 @@ you won't need it for this app so you can remove it.</li>
|
|||||||
Keep this one the way it is.</li>
|
Keep this one the way it is.</li>
|
||||||
</ul>
|
</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>
|
<pre>
|
||||||
public class DisplayMessageActivity extends Activity {
|
public class DisplayMessageActivity extends Activity {
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_display_message);
|
setContentView(R.layout.activity_display_message);
|
||||||
|
|
||||||
|
// 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.
|
// Show the Up button in the action bar.
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ public void onReceive(Context context, Intent intent) {
|
|||||||
// asynchronous call and the calling activity is notified with a
|
// asynchronous call and the calling activity is notified with a
|
||||||
// callback on PeerListListener.onPeersAvailable()
|
// callback on PeerListListener.onPeersAvailable()
|
||||||
if (mManager != null) {
|
if (mManager != null) {
|
||||||
mManager.requestPeers(mChannel, peerListener);
|
mManager.requestPeers(mChannel, peerListListener);
|
||||||
}
|
}
|
||||||
Log.d(WiFiDirectActivity.TAG, "P2P peers changed");
|
Log.d(WiFiDirectActivity.TAG, "P2P peers changed");
|
||||||
}...
|
}...
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ This constructor allows the layout editor to create and edit an instance of your
|
|||||||
|
|
||||||
<pre class="prettyprint">
|
<pre class="prettyprint">
|
||||||
class PieChart extends View {
|
class PieChart extends View {
|
||||||
public PieChart(Context ctx, AttributeSet attrs) {
|
public PieChart(Context context, AttributeSet attrs) {
|
||||||
super(ctx, attrs);
|
super(context, attrs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -104,7 +104,7 @@ enable this behavior in your custom view, you must:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
<resources>;
|
<resources>
|
||||||
<declare-styleable name="PieChart">
|
<declare-styleable name="PieChart">
|
||||||
<attr name="showText" format="boolean" />
|
<attr name="showText" format="boolean" />
|
||||||
<attr name="labelPosition" format="enum">
|
<attr name="labelPosition" format="enum">
|
||||||
@@ -189,8 +189,8 @@ enable this behavior in your custom view, you must:
|
|||||||
reads its attributes:</p>
|
reads its attributes:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
public PieChart(Context ctx, AttributeSet attrs) {
|
public PieChart(Context context, AttributeSet attrs) {
|
||||||
super(ctx, attrs);
|
super(context, attrs);
|
||||||
TypedArray a = context.getTheme().obtainStyledAttributes(
|
TypedArray a = context.getTheme().obtainStyledAttributes(
|
||||||
attrs,
|
attrs,
|
||||||
R.styleable.PieChart,
|
R.styleable.PieChart,
|
||||||
|
|||||||
Reference in New Issue
Block a user