<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by AndroiHeight on Medium]]></title>
        <description><![CDATA[Stories by AndroiHeight on Medium]]></description>
        <link>https://medium.com/@androidheight?source=rss-c73e92b60a16------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jj1BPWh8x3V3Q8IW0TioyA.png</url>
            <title>Stories by AndroiHeight on Medium</title>
            <link>https://medium.com/@androidheight?source=rss-c73e92b60a16------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:31:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@androidheight/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Template Code in Android Studio]]></title>
            <link>https://medium.com/greenbee/creating-template-code-in-android-studio-30520fd5132a?source=rss-c73e92b60a16------2</link>
            <guid isPermaLink="false">https://medium.com/p/30520fd5132a</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[AndroiHeight]]></dc:creator>
            <pubDate>Wed, 17 May 2017 07:21:44 GMT</pubDate>
            <atom:updated>2019-01-20T12:41:37.180Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have been coding from long time, and don’t used this cool feature of Live code template then you wasted your time in writing some repeated code. Don’t worry this article is all about Live code template. So lets learn together .</p><h3><strong>Why Live Template ?</strong></h3><p>Many time a small mistakes happen when we do coding for example</p><p>//snippet of code</p><p><strong>Toast.makeToast(YourActivity.this,getString(R.string.mystring),Toast.LengthLong);</strong></p><p>So the above <strong>Toast</strong> will not be shown, Hence to avoid this kind of stuff which we generally use in our programming, We can utilize this concept.</p><p>So To avoid this kind of mistakes we can use <strong>Live Code Template.</strong></p><p><strong>What this Live Template all about ?</strong></p><p>If you are users of IntelliJ you will be aware of this concept, Anyway this concept is similar to the code completion, or shortcut of the code like auto code completion do.</p><p>So we can also create our own Template instead of writing repetitive boilerplate.</p><p><strong>Android Studio Live Template: Handy Reference</strong></p><p>IntelliJ includes by default some of the Live Templates for us and Even we can make a large code for the Live template, Even we can make a class to be template.</p><p>In this way it will remove repetitive writing of codes .</p><p><strong>What we are waiting for ? Lets Start</strong></p><p>The steps of Creating Live Template are quite simple and easy to implement.</p><p>So initially it may take some time for you to create the template code but I bet you it will save your Tons of time in coming days.</p><p>So before starting the steps there is common thing which needs to be discussed is the naming and description of the code which we wants to make live template .</p><p>It is very important strategy because creating tons of template and searching it across autocomplete suggestions will puzzle you in future so I have some strategy for this it is again a <strong>HOT</strong> topic so not going in deep just follow some basic rule (its not universal you may implement your own because end of the day you have to implement).</p><p><strong>Naming Strategies</strong></p><p>Just think of <strong>WHY</strong> this template is necessary so that you can make decision to include it or not.</p><p>Ask yourself some few things</p><p><strong>What</strong> this all about.</p><p><strong>Where</strong> it is helpful.</p><p><strong>Why and what</strong> is important Example</p><p>Toast.<em>makeText</em>(<strong>instance</strong>, R.string.<strong><em>app_name</em></strong>, Toast.<strong><em>LENGTH_LONG</em></strong>).show();</p><p>Whyà{PROMPT}</p><p>Whatà{Toast}</p><p>Whereà{screen}</p><p>Hence the preferred abbreviation will be <strong>PTS</strong> and name would be like<strong>promp_toast_activity</strong> or anything you remember its just an organizing thing technique.</p><p>So now below are some steps which will help you to create a live template I am stating this with an example.</p><p><strong>Steps</strong></p><p>1. Write the code to the Android Studio editor .</p><p>2. Select and copy the as shown below .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*eTmA9jzNvBvaDTa_.png" /></figure><p>3. Go to Menu bar and click on <strong>Insert live Template</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*lGfblFuTyCrr2z54.png" /></figure><p>4. Go to the edit box and paste the code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/0*-J9kZaBTjPPleU5S.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*kHGY3r8yyjvBNhMA.png" /></figure><p>5. Write description and abbreviation which you wants to give.</p><p>6. Now apply this code click ok.</p><p>7. That’s it you have done this.</p><p><strong>Edit Steps.</strong></p><p>You may follow the above steps for edit as well but there is short cut to go there <strong>command +J </strong>and then go to your abbreviated template name and just select it you will see a yellow marker at the right click it and a menu Edit live template setting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*syM5vGQGzmWBSKj4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*65hq7L1AkOUrHxCr.png" /></figure><p>Change your setting accordingly.</p><p><strong>Happy coding</strong> 😄</p><p>Don’t forget to subscribe us ,add your comments/suggestions anything is appreciated</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30520fd5132a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/greenbee/creating-template-code-in-android-studio-30520fd5132a">Creating Template Code in Android Studio</a> was originally published in <a href="https://medium.com/greenbee">GreenBee</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>