summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorRich Slogar <rslogar@google.com>2015-07-22 16:05:44 -0700
committerRich Slogar <rslogar@google.com>2015-07-29 16:21:05 -0700
commit2f3c16659b4ee5de54fe297e8e797d8631aab7d5 (patch)
tree6f8154cdf14ac2c420c71f9a04a1b5638a125244 /docs
parenta758133566e030275988fb3bf253a432e6803d8f (diff)
downloadframeworks_base-2f3c16659b4ee5de54fe297e8e797d8631aab7d5.zip
frameworks_base-2f3c16659b4ee5de54fe297e8e797d8631aab7d5.tar.gz
frameworks_base-2f3c16659b4ee5de54fe297e8e797d8631aab7d5.tar.bz2
docs: studio 1.3 live templates
Change-Id: I23e38b69d3cbecf42e5a0b32e5853813fb43a1d5
Diffstat (limited to 'docs')
-rw-r--r--docs/html/sdk/installing/studio-tips.jd33
1 files changed, 32 insertions, 1 deletions
diff --git a/docs/html/sdk/installing/studio-tips.jd b/docs/html/sdk/installing/studio-tips.jd
index 7d37b1d..b8511a4 100644
--- a/docs/html/sdk/installing/studio-tips.jd
+++ b/docs/html/sdk/installing/studio-tips.jd
@@ -131,11 +131,42 @@ a class, method, or field from a library for which you do not have source file a
build and run code prototypes. Together with Android Studio coding assistance, scratch
files allow you to quickly run and debug code updates with the support of all file operations.
By embedding code created with scripting languages, you can run your code from within the
- scratch file.</p>
+ scratch file.</p>
</li>
</ul>
+<h3 id="live-template">Live templates</h3>
+<p>Live templates allow you to enter code snippets for fast insertion and completion of small chunks
+of code. To insert a live template, type the template abbreviations and press the
+Tab key. Android Studio inserts the code snippet associated with the template into
+your code. </p>
+
+<p>For example, entering the <code>newInstance</code> abbreviation followed by the
+Tab key inserts the code for a new fragment instance with argument placeholders. </p>
+
+<pre>
+public static $fragment$ newInstance($args$) {
+ $nullChecks$
+ Bundle args = new Bundle();
+ $addArgs$
+ $fragment$ fragment = new $fragment$();
+ fragment.setArguments(args);
+ return fragment;
+}
+</pre>
+
+<p>Similarly, the <code>fbc</code> abbreviation inserts a <code>findViewById</code> call along
+with cast and resource id syntax. </p>
+
+<pre>
+() findViewById(R.id.);
+</pre>
+
+<p>Use the <strong>File &gt; Settings &gt; Editor &gt; Live Templates</strong> menu option to
+display the full list of supported live templates and customize the inserted code. </p>
+
+
<h2 id="intellij">Working with IntelliJ-based Coding Practices</h3>