am 181bb3aa: am 921c8a5d: am 4e483ed3: Merge "docs: misc bug fixes. including important versioning fixes for first app class" into jb-mr1-dev
* commit '181bb3aabc81f7e834e62874065c640dbc900f3e': docs: misc bug fixes. including important versioning fixes for first app class
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>
|
||||
|
||||
<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>
|
||||
|
||||
@@ -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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -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
|
||||
android.os.IBinder} (usually the one passed to a client's {@link
|
||||
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>
|
||||
|
||||
<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.
|
||||
String[] selelectionArgs = { String.valueOf(rowId) };
|
||||
// Issue SQL statement.
|
||||
db.delete(table_name, mySelection, selectionArgs);
|
||||
db.delete(table_name, selection, selectionArgs);
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -263,7 +263,7 @@ public void onReceive(Context context, Intent intent) {
|
||||
// asynchronous call and the calling activity is notified with a
|
||||
// callback on PeerListListener.onPeersAvailable()
|
||||
if (mManager != null) {
|
||||
mManager.requestPeers(mChannel, peerListener);
|
||||
mManager.requestPeers(mChannel, peerListListener);
|
||||
}
|
||||
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">
|
||||
class PieChart extends View {
|
||||
public PieChart(Context ctx, AttributeSet attrs) {
|
||||
super(ctx, attrs);
|
||||
public PieChart(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@@ -104,7 +104,7 @@ enable this behavior in your custom view, you must:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<resources>;
|
||||
<resources>
|
||||
<declare-styleable name="PieChart">
|
||||
<attr name="showText" format="boolean" />
|
||||
<attr name="labelPosition" format="enum">
|
||||
@@ -189,8 +189,8 @@ enable this behavior in your custom view, you must:
|
||||
reads its attributes:</p>
|
||||
|
||||
<pre>
|
||||
public PieChart(Context ctx, AttributeSet attrs) {
|
||||
super(ctx, attrs);
|
||||
public PieChart(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
TypedArray a = context.getTheme().obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.PieChart,
|
||||
|
||||
Reference in New Issue
Block a user