<?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[Android App Development for beginners - Medium]]></title>
        <description><![CDATA[This medium is for Android App developers for the beginners - Medium]]></description>
        <link>https://medium.com/android-app-development-for-beginners?source=rss----5987d5bb5e60---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Android App Development for beginners - Medium</title>
            <link>https://medium.com/android-app-development-for-beginners?source=rss----5987d5bb5e60---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 12:13:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/android-app-development-for-beginners" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Intellij(2021.3) New updates for development Android]]></title>
            <link>https://medium.com/android-app-development-for-beginners/intellij-2021-3-new-updates-for-development-android-a914e793bc67?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/a914e793bc67</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[intellij]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Sat, 24 Sep 2022 12:40:48 GMT</pubDate>
            <atom:updated>2022-09-24T12:35:00.919Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Folks in this article I would like share new the updates of Intellij IDE(2021.3)and useful for android app development.Key points going to share.</p><h3>Kotlin updates for development and debugging</h3><p>1 ) Constant conditions inspection for kotlin</p><p>In this update IDE will inspect the conditions and inform to developer is any modification is needed for that condition with suggestions. With <strong>Simplify comparison or More actions options </strong>selection it will modify the conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*xI-cAF96wRMQ0qbY8uaD8Q.png" /></figure><p>2) Debugger updates for kotlin</p><p>If we want to debug the method chain in kotlin language now we can use smart step into. With this option we can debug the method easily.First we have to attach debugger to program and add the break points then in method chain break point execution we have to select smart step into option in Debugger window or we can click F7. It will show method chains entry points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*_e95_dQBcngUKlemy0TxHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*JwnKV6oDAlygCcQnFIKF-g.png" /><figcaption>Pink highlighted executions method chain execution points.</figcaption></figure><p>3) Inline hints for ranges</p><p>Now in ranges it provide hints to the number range in the form of symbols &gt;,&lt;&gt;=,&lt;= in kotlin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f_hbq27FxO3ILkE1.png" /></figure><p>4) Extract constant refactoring</p><p>We can do Constants refactoring extraction by selecting the constant and press ctrl+alt+c it will extract the constant from the expression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YQozyT8ofM134n0A.gif" /></figure><h3>User experience updates</h3><ol><li>New Bookmarks tool window</li></ol><p>Now in Bookmarks window we can create a lists we can categorize our bookmarks. For this in Bookmarks window we have create a list and start adding the book marks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eo5es-67v1EyfC9joIxQ0w.png" /><figcaption>This is the output i have created</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EwzY0xWqCmiIICg2.gif" /></figure><p>2) Reworked show usages</p><p>There is new improvement in show usages we can now see the source code preview and number of places it was used. Place the cursor on the method and click ctrl+B I will show the implementation window in that we have preview source and number of places it was used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*8ebEdjjZAzvhothEzQdKGA.png" /></figure><p>These are the options I have used and there lot more please refer from this.</p><p><a href="https://www.jetbrains.com/idea/whatsnew/2021-3/">https://www.jetbrains.com/idea/whatsnew/2021-3/</a></p><p>I hope these are use full for every developer. Thanks next time I will come with VCS updates in intellij topic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a914e793bc67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/intellij-2021-3-new-updates-for-development-android-a914e793bc67">Intellij(2021.3) New updates for development Android</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create RecyclerView.Adapter Adapter with One-Click]]></title>
            <link>https://medium.com/android-app-development-for-beginners/create-recyclerview-adapter-adapter-with-one-click-bab188f2b6a5?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/bab188f2b6a5</guid>
            <category><![CDATA[android-studio]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Wed, 20 May 2020 03:53:14 GMT</pubDate>
            <atom:updated>2019-08-25T13:52:58.182Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi Developers while Developing Android Project we commonly use RecyclerView for displaying Data in the form of list. If we have to create multiple times we going to copy past the code and modify the code to avoid this we have simple solution in-front of us. Follow these steps.</p><ol><li>Open the Settings dialog in android studio from <strong>File-&gt;Settings </strong>then select <strong>Editor-&gt;File and Code Templates </strong>option then add new file template by clicking <strong>+ </strong>icon</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXBK4z9MeRzYi18HKakPSQ.png" /><figcaption>Creating File Templates</figcaption></figure><p>2. Then Provide the name for the template Eg. RecyclerViewAdapter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UlMtUy0X6joaEuN-RFNarQ.png" /><figcaption>Template name RecyclerViewAdapter.</figcaption></figure><p>3. Then Past the provided code here</p><p>#if (${PACKAGE_NAME} != “”)package ${PACKAGE_NAME};#end</p><p>import android.content.Context;<br>import android.support.annotation.NonNull;<br>import android.support.v7.widget.RecyclerView;<br>import android.view.LayoutInflater;<br>import android.view.View;<br>import android.view.ViewGroup;</p><p>import java.util.ArrayList;</p><p>public class ${NAME} extends RecyclerView.Adapter&lt;${NAME}.${ViewHolderName}&gt; {<br>private Context context;<br>private ArrayList&lt;String&gt;list;</p><p>public ${NAME}(Context context,ArrayList&lt;String&gt; list) {<br> this.context = context;<br> this.list=list;<br> }<br> <a href="http://twitter.com/NonNull">@NonNull</a><br> <a href="http://twitter.com/Override">@Override</a><br> public ${NAME}.${ViewHolderName} onCreateViewHolder(<a href="http://twitter.com/NonNull">@NonNull</a> ViewGroup viewGroup, int i) {<br> View view = LayoutInflater.from(context).inflate(R.layout.${Layout}, viewGroup, false);<br> return new ${NAME}.${ViewHolderName}(view);<br> }</p><p><a href="http://twitter.com/Override">@Override</a><br> public void onBindViewHolder(<a href="http://twitter.com/NonNull">@NonNull</a> ${NAME}.${ViewHolderName} viewHolder, int i) {</p><p>}</p><p><a href="http://twitter.com/Override">@Override</a><br> public int getItemCount() {<br> return list.size();<br> }<br> class ${ViewHolderName} extends RecyclerView.ViewHolder{<br> public ${ViewHolderName}(<a href="http://twitter.com/NonNull">@NonNull</a> View itemView) {<br> super(itemView);<br> }<br> }<br>}</p><p>4. That’s it you crated a file template. Now we have to use it Right click on the folder to insert new Adapter File. Select New-&gt;RecyclerViewAdapter Option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrVj1osiS-Devon_dDcB9Q.png" /><figcaption>RecyclerViewAdapter Option</figcaption></figure><p>5. Now provide the AdapterName, ViewHolder name, Layout name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*FxM2zyQrB0h4NMTuIL_eFA.png" /></figure><p>6. That’s it our work is easy with this small one time file creation reduce our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aPkgVKHWOL91SXyJc8niMQ.png" /></figure><p>If you like my article, please don’t forget to click 👏👏👏 to recommend it to others 👏👏👏.</p><p>Also, to be notified about my new articles and stories, follow me on <a href="https://twitter.com/YUGANDHAR_dcs21">Twitter</a>. You can find me on <a href="https://www.linkedin.com/in/yugandhar-vadlamudi-a513729b/">LinkedIn </a>as well. Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bab188f2b6a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/create-recyclerview-adapter-adapter-with-one-click-bab188f2b6a5">Create RecyclerView.Adapter Adapter with One-Click</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Toolbar Android]]></title>
            <link>https://medium.com/android-app-development-for-beginners/toolbar-android-1d1e8156ec8c?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/1d1e8156ec8c</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[search-toolbar-android]]></category>
            <category><![CDATA[toolbar-android]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Mon, 06 Mar 2017 11:52:27 GMT</pubDate>
            <atom:updated>2017-03-06T11:51:56.243Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>Toolbar is a view introduced in Android Lollipop(API 21) the spiritual successor of the ActionBar(Actionbar is replaced with Toolbar)</li><li>Appearance and behavior can be more easily customized than the ActionBar.</li><li>Works well with app’s targeted to API 21 and above.</li><li>Android has updated the AppCompat support libraries so the Toolbar can be used on lower Android OS devices as well.</li></ul><h4>Toolbar Advantages</h4><ul><li>Toolbar is a View included in a layout like any other View</li><li>As a regular View, the toolbar is easier to position, animate and control</li></ul><h4>Using Toolbar as Action-Bar</h4><ul><li>To use Toolbar as an ActionBar, first ensure the AppCompat-v7 support library is added to your application</li></ul><p><em>build.gradle (Module:app) file</em></p><pre>dependencies {</pre><pre>compile &#39;com.android.support:appcompat-v7:25.2.0&#39;</pre><pre>compile &#39;com.android.support:design:25.2.0&#39;</pre><pre>}</pre><ul><li>disable the theme-provided ActionBar</li></ul><p><em>res/styles.xml file:</em></p><pre><strong>&lt;resources&gt;<br><em>&lt;!-- Base application theme. --&gt;<br>&lt;style name=&quot;AppTheme&quot; parent=&quot;</em>Theme.AppCompat.Light.NoActionBar<em>&quot;&gt;&lt;!-- Customize your theme here. --&gt;<br>&lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;<br>&lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;<br>&lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;<br>&lt;/style&gt;<br>&lt;/resources&gt;</em></strong></pre><ul><li>Now add a Toolbar to your Activity in layout file</li></ul><pre><em>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;</em><strong>&lt;android.support.v7.widget.Toolbar<br>android:id=&quot;@+id/tb_toolbarmain&quot;<br>android:layout_height=&quot;?attr/actionBarSize&quot;<br>android:background=&quot;@color/colorPrimaryDark&quot;&gt;<br>&lt;/android.support.v7.widget.Toolbar&gt;</strong><br><em>&lt;View<br>android:layout_width=&quot;match_parent&quot;<br>android:layout_height=&quot;10dp&quot;<br>android:background=&quot;@drawable/toolbar_dropshadow&quot; /&gt;<br>&lt;/LinearLayout&gt;</em></pre><ul><li>Activity.java</li></ul><pre><strong>public class </strong>ToolbarMainActivity <strong>extends </strong>AppCompatActivity {<br><br>    <strong>private </strong>Toolbar <strong>tbtoolbarmain</strong>;<br><br><br>    @Override<br>    <strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_toolbar_main</em></strong>);<br>        initViews();<br>    }<br><br>    <strong>private void </strong>initViews() {<br>        <em>//find the toolbar view from layout<br>        </em><strong>tbtoolbarmain </strong>= (Toolbar) findViewById(R.id.<strong><em>tb_toolbarmain</em></strong>);<br>        <em>//set the toolbar view as actionbar for app<br>        </em>setSupportActionBar(<strong>tbtoolbarmain</strong>);<br>        <em>//Enabling the Navigation icon in toolbar<br>        </em>getSupportActionBar().setDisplayHomeAsUpEnabled(<strong>true</strong>);<br>        <em>//Title of the toolbar<br>        </em>getSupportActionBar().setTitle(<strong>&quot;Title&quot;</strong>);<br>        <em>//subtitle of the toolbar<br>        </em>getSupportActionBar().setSubtitle(<strong>&quot;Sub Title&quot;</strong>);<br>        LinearLayout.LayoutParams layoutParams<br>                = (LinearLayout.LayoutParams) <strong>tbtoolbarmain</strong>.getLayoutParams();<br><em>//        layoutParams.height = Toolbar.LayoutParams.MATCH_PARENT;<br>        </em><strong>tbtoolbarmain</strong>.setLayoutParams(layoutParams);<br><br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*SvmlP02xlXPb6VVnSwyTRA.png" /><figcaption>Toolbar output in device</figcaption></figure><blockquote>if you like this tutorial be sure to<a href="https://medium.com/@yugandhardcs21"> follow me on medium </a>recommend this tutorial to others</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d1e8156ec8c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/toolbar-android-1d1e8156ec8c">Toolbar Android</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bottom Sheets in Material Design]]></title>
            <link>https://medium.com/android-app-development-for-beginners/bottom-sheets-in-material-design-30b5c8455c40?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/30b5c8455c40</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[persistent-bottom-sheet]]></category>
            <category><![CDATA[bottomsheet]]></category>
            <category><![CDATA[material-design]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Tue, 22 Nov 2016 12:24:30 GMT</pubDate>
            <atom:updated>2016-09-15T11:07:35.115Z</atom:updated>
            <content:encoded><![CDATA[<h4>What is Bottom Sheet</h4><ul><li>A<strong> <em>bottom sheet</em></strong> is a sheet that slides up from the bottom edge of the screen.</li><li>Bottom sheets are displayed as a result of user triggered action, and also it can reveal additional content by swiping up.</li></ul><blockquote>Bottom sheets are added to the <strong>Android Support Library</strong> in v23.2.0 version.</blockquote><h4>Bottom sheets have two use cases:</h4><ul><li>Persistent Bottom Sheet</li><li>Modal Bottom Sheet</li></ul><h4>Persistent Bottom Sheet</h4><p>Persistent bottom sheets remain visible on the screen. You can convert any view in your layout to a persistent bottom sheet.</p><p>For <strong>persistent bottom sheet</strong> to work, your layout should contain a coordinator layout, and then in any child view of your coordinator layout, you can make it as a persistent bottom sheet by adding a custom property “app:layout_behavior”.</p><pre>&lt;android.support.design.widget.CoordinatorLayout<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>    tools:context=&quot;com.compindia.bottomsheetesexampleapp.MainActivity&quot;&gt;<br>    &lt;Button<br>        android:id=&quot;@+id/bt_main&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:text=&quot;CLick&quot;<br>        /&gt;<br>    <em>&lt;!--</em><br>    <em>Persistent BottomSheet in android example</em><br>    <em>--&gt;</em><br>    &lt;FrameLayout<br>        android:id=&quot;@+id/fl_main&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;300dp&quot;<br>        android:background=&quot;@color/colorPrimary&quot;<br>        android:fitsSystemWindows=&quot;true&quot;<br>        <strong>app:behavior_peekHeight=&quot;50dp&quot;</strong><br>        <strong>app:layout_behavior=&quot;@string/bottom_sheet_behavior&quot;</strong><br>        &gt;<br>        &lt;include layout=&quot;@layout/layout_bootomsheet&quot;/&gt;<br>    &lt;/FrameLayout&gt;<br>&lt;/android.support.design.widget.CoordinatorLayout&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*5UM4cN7coXv4YLhi2VGmjQ.png" /></figure><h4>Modal Bottom Sheet</h4><p>Modal bottom sheets are dialogs which are alternatives to content choosers, simple menus, and dialogs.</p><pre><strong>public class </strong>MainActivity <strong>extends </strong>AppCompatActivity {<br>    <strong>private </strong>Button <strong>btMain</strong>;<br>    <strong>private </strong>FrameLayout <strong>flMain</strong>;<br>    <strong>private </strong>BottomSheetDialog <strong>bottomSheetBehavior</strong>;<br>    @Override<br>    <strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_main</em></strong>);<br>        setUpViews();<br>    }<br>    <strong>private void </strong>setUpViews() {<br>        <strong>btMain </strong>= (Button) findViewById(R.id.<strong><em>bt_main</em></strong>);<br>        <strong>btMain</strong>.setOnClickListener(<strong>new </strong>View.OnClickListener() {<br>            @Override<br>            <strong>public void </strong>onClick(View view) {<br>                View layoutDialog = getLayoutInflater().inflate(R.layout.<strong><em>layout_bootomsheet</em></strong>, <strong>null</strong>);<br>                <em>/**</em><br>                <em>* ModelBottom Sheet in android example</em><br>                <em>* */</em><br>                <strong>bottomSheetBehavior </strong>= <strong>new </strong>BottomSheetDialog(MainActivity.<strong>this</strong>);<br>                <strong>bottomSheetBehavior</strong>.setContentView(layoutDialog);<br>                <strong>bottomSheetBehavior</strong>.show();<br>            }<br>        });<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*cM_2xDrVFyLau84CR_ibPA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30b5c8455c40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/bottom-sheets-in-material-design-30b5c8455c40">Bottom Sheets in Material Design</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swipe Dismiss with Coordinate layout]]></title>
            <link>https://medium.com/android-app-development-for-beginners/swipe-dismiss-with-coordinate-layout-d761df3ee264?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/d761df3ee264</guid>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[coordinatelayout]]></category>
            <category><![CDATA[cardview]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[swipedismiss-android]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Fri, 29 Jul 2016 12:09:27 GMT</pubDate>
            <atom:updated>2016-07-29T10:41:57.065Z</atom:updated>
            <content:encoded><![CDATA[<h4>CoordinatorLayout</h4><ul><li>CoordinatorLayout is a super-powered FrameLayout.</li><li>It is intended for two primary use cases:</li></ul><ol><li>As a top-level application decor or chrome layout</li><li>As a container for a specific interaction with one or more child views</li></ol><blockquote>To I am going to implement how to do a swipe dismiss the Cardview with Coordinate Layout</blockquote><p>Preparing for Swipe Dismiss</p><ul><li>CoordinateLayout</li><li>CardView</li><li>SwipeDismissBehavior Class</li></ul><h4>CardView</h4><p>A FrameLayout with a rounded corner background and shadow.</p><h4>SwipeDismissBehavior</h4><p>An interaction behavior plugin for child views of CoordinatorLayout to provide support for the ‘swipe-to-dismiss’ gesture.</p><blockquote>Now Implementation</blockquote><p>layout.xml</p><pre>&lt;RelativeLayout<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;    tools:context=&quot;com.swipedismissapplication.SwipeDismissActivity&quot;&gt;<br><br>    &lt;android.support.design.widget.<strong>CoordinatorLayout</strong><br>        android:id=&quot;@+id/cl_swipedismiss&quot;<br>        android:layout_width=&quot;match_parent&quot;<br>        android:layout_height=&quot;match_parent&quot;<br>        &gt;<br><br>        &lt;android.support.v7.widget.<strong>CardView</strong><br>            android:id=&quot;@+id/cv_swipedismiss&quot;<br>            android:layout_width=&quot;match_parent&quot;<br>            android:layout_height=&quot;wrap_content&quot;<br>            android:background=&quot;@color/colorAccent&quot;<br>            &gt;<br><br>            &lt;TextView<br>                android:layout_width=&quot;wrap_content&quot;<br>                android:layout_height=&quot;wrap_content&quot;<br>                android:text=&quot;Hello World!&quot;<br>                android:textSize=&quot;30dp&quot;<br>                /&gt;<br>        &lt;/android.support.v7.widget.<strong>CardView</strong>&gt;<br>    &lt;/android.support.design.widget.<strong>CoordinatorLayout</strong>&gt;<br>&lt;/RelativeLayout&gt;</pre><p>Activity.java</p><pre><strong>public class </strong>SwipeDismissActivity <strong>extends </strong>AppCompatActivity {<br><br><br>    <strong>private </strong>CardView <strong>cvSwipeDismiss</strong>;<br><br>    @Override<br>    protected void<strong> onCreate</strong>(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_swipe_dismiss</em></strong>);<br>        <strong>setUpViews();<br>        swipeDismiss();</strong><br>    }<br><br>    private void<strong> swipeDismiss</strong>() {<br><strong>//&lt;V&gt; - The View type that this Behavior operates on</strong></pre><pre>        <strong>SwipeDismissBehavior</strong>&lt;CardView&gt; swipeDismissBehavior=<strong>new SwipeDismissBehavior</strong>();<br>        swipeDismissBehavior.setSwipeDirection(SwipeDismissBehavior.<strong><em>SWIPE_DIRECTION_ANY </em></strong>);<br>        CoordinatorLayout.LayoutParams layoutParams =<br>                (CoordinatorLayout.LayoutParams) <strong>cvSwipeDismiss</strong>.getLayoutParams();<br>        layoutParams.setBehavior(swipeDismissBehavior);<br><br>    }<br><br>    private void<strong> setUpViews</strong>() {<br>    <strong>cvSwipeDismiss </strong>= (CardView) findViewById(R.id.<strong><em>cv_swipedismiss</em></strong>);<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*ETHAhgV0bWswoBDMxGe15A.png" /><figcaption><strong>Dismiss the CardView by Swiping to any direction</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d761df3ee264" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/swipe-dismiss-with-coordinate-layout-d761df3ee264">Swipe Dismiss with Coordinate layout</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drag and Drop]]></title>
            <link>https://medium.com/android-app-development-for-beginners/drag-and-drop-1ee43ad2fa78?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/1ee43ad2fa78</guid>
            <category><![CDATA[drag-drop]]></category>
            <category><![CDATA[android-dragdrop]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Mon, 25 Jul 2016 11:48:15 GMT</pubDate>
            <atom:updated>2016-07-25T11:47:51.394Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>we can allow your users to move data from one View to another View in the current layout using a graphical drag and drop gesture.</li><li>A drag and drop operation starts when the user makes some gesture that you recognize as a signal to start dragging data.</li><li>In response, your application tells the system that the drag is starting.</li></ul><h4>The drag/drop process</h4><ul><li><em>Started</em></li><li><em>Continuing</em></li><li><em>Dropped</em></li><li><em>Ended</em></li></ul><p><strong><em>Started</em></strong><em>:</em> In response to the user’s gesture to begin a drag, your application calls startDrag() to tell the system to start a drag.</p><p><strong><em>Continuing</em></strong> :The user continues the drag.</p><p><strong><em>Dropped</em></strong> :The user releases the drag shadow within the bounding box of a View that can accept the data.</p><p><strong><em>Ended</em></strong> :After the user releases the drag shadow, and after the system sends out (if necessary) a drag event with action type ACTION_DROP, the system sends out a drag event with action type ACTION_DRAG_ENDED to indicate that the drag operation is over.</p><h4>The drag shadow</h4><p>During a drag and drop operation, the system displays a image that the user drags. For data movement, this image represents the data being dragged. For other operations, the image represents some aspect of the drag operation.</p><pre><strong>layout.xml</strong></pre><pre>&lt;RelativeLayout<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;<br>    tools:context=&quot;com.compindia.dragdropapp.DropDropActivity&quot;&gt;<br>    &lt;LinearLayout<br>        android:id=&quot;@+id/ll_pinklayout&quot;<br>        android:orientation=&quot;vertical&quot;<br>        android:layout_height=&quot;@dimen/height_lldrop&quot;<br>        android:background=&quot;#FF8989&quot;<br>        &gt;<br>        &lt;TextView<br>            android:id=&quot;@+id/tv_dropdrop&quot;<br>            android:text=&quot;Drag Text&quot;<br>            android:textSize=&quot;@dimen/size_tvdrop&quot;<br>            /&gt;<br>    &lt;/LinearLayout&gt;<br>&lt;/RelativeLayout&gt;</pre><pre><strong>activity.java</strong></pre><pre>public class DropDropActivity extends AppCompatActivity implements View.OnTouchListener, View.OnDragListener {<br>    private String TAG = DropDropActivity.class.getSimpleName();<br>    private LinearLayout llPinkLayout;<br>    private TextView tvDragView;<br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_drop_drop</em>);<br>        setUpViews();<br>        setListeners();<br>    }<br>    private void setListeners() {<br>        tvDragView.setOnTouchListener(this);<br>        llPinkLayout.setOnDragListener(this);<br>    }<br>    private void setUpViews() {<br>        llPinkLayout = (LinearLayout) findViewById(R.id.<em>ll_pinklayout</em>);<br>        tvDragView = (TextView) findViewById(R.id.<em>tv_dropdrop</em>);<br>    }<br>    @Override<br>    public boolean onDrag(View view, DragEvent dragEvent) {<br>        Log.<em>d</em>(TAG, &quot;onDrag: view-&gt;&quot; + view + &quot;\n DragEvent&quot; + dragEvent);<br>        switch (dragEvent.getAction()) {<br>            case DragEvent.<em>ACTION_DRAG_ENDED</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DRAG_ENDED &quot;);<br>                return true;<br>            case DragEvent.<em>ACTION_DRAG_EXITED</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DRAG_EXITED&quot;);<br>                return true;<br>            case DragEvent.<em>ACTION_DRAG_ENTERED</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DRAG_ENTERED&quot;);<br>                return true;<br>            case DragEvent.<em>ACTION_DRAG_STARTED</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DRAG_STARTED&quot;);<br>                return true;<br>            case DragEvent.<em>ACTION_DROP</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DROP&quot;);<br>                View tvState = (View) dragEvent.getLocalState();<br>                Log.<em>d</em>(TAG, &quot;onDrag:viewX&quot; + dragEvent.getX() + &quot;viewY&quot; + dragEvent.getY());<br>                Log.<em>d</em>(TAG, &quot;onDrag: Owner-&gt;&quot; + tvState.getParent());<br>                ViewGroup tvParent =(ViewGroup) tvState.getParent();<br>                tvParent.removeView(tvState);<br>                LinearLayout container = (LinearLayout)view;<br>                container.addView(tvState);<br>                LinearLayout contariner = (LinearLayout) view;<br>                tvParent.removeView(tvState);<br>                tvState.setX(dragEvent.getX());<br>                tvState.setY(dragEvent.getY());<br>                ((LinearLayout) view).addView(tvState);<br>                view.setVisibility(View.<em>VISIBLE</em>);<br>                return true;<br>            case DragEvent.<em>ACTION_DRAG_LOCATION</em>:<br>                Log.<em>d</em>(TAG, &quot;onDrag: ACTION_DRAG_LOCATION&quot;);<br>                return true;<br>            default:<br>                return false;<br>        }<br>    }<br>    @Override<br>    public boolean onTouch(View view, MotionEvent motionEvent) {<br>        Log.<em>d</em>(TAG, &quot;onTouch: view-&gt;view&quot; + view + &quot;\n MotionEvent&quot; + motionEvent);<br>        if (motionEvent.getAction() == MotionEvent.<em>ACTION_DOWN</em>) {<br>            View.DragShadowBuilder dragShadowBuilder = new View.DragShadowBuilder(view);<br>            view.startDrag(null, dragShadowBuilder, view, 0);<br>            return true;<br>        } else {<br>            return false;<br>        }<br>    }<br>}</pre><p>#output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*HimolcPump7MmY7MywFNNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*ZfD3HJEtwfKRmyzE6RPh8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*pvt4iAFYMsf_-zMuTyuIUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*EdnB9CjVwvtRBr9XhnVkFA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ee43ad2fa78" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/drag-and-drop-1ee43ad2fa78">Drag and Drop</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reveal Effect in material design]]></title>
            <link>https://medium.com/android-app-development-for-beginners/reveal-effect-in-material-design-27e1306f0613?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/27e1306f0613</guid>
            <category><![CDATA[material-design-animation]]></category>
            <category><![CDATA[circular-reveal]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Mon, 25 Jul 2016 10:44:51 GMT</pubDate>
            <atom:updated>2016-07-15T11:41:26.568Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>Animations in material design give users feedback on their actions and provide visual continuity as users interact with your app.</li><li>Android 5.0 (API level 21) and above lets you customize these animations and create new ones</li><li>Touch feedback</li><li><strong>Circular Reveal</strong></li><li>Activity transitions</li><li>Curved motion</li><li>View state changes</li></ul><blockquote><em>In this post i am going to discuss about </em><strong>Circular Reveal</strong> <em>animation and how to customize touch feedback animation .The common touch feedback animation in material design is ripple effect</em></blockquote><h3>Use the Reveal Effect</h3><ul><li>Reveal animations provide users visual continuity when you show or hide a group of UI elements.</li><li>The <a href="https://developer.android.com/reference/android/view/ViewAnimationUtils.html#createCircularReveal(android.view.View,%20int,%20int,%20float,%20float)">ViewAnimationUtils.createCircularReveal()</a>method enables you to animate view</li></ul><h4>To reveal a previously invisible view using this effect:</h4><p>layout.xml</p><pre><strong>&lt;LinearLayout<br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;<br>    tools:context=&quot;com.compindia.circlerevealapp.CircleRevealActivity&quot;&gt;<br>    &lt;Button<br>        android:id=&quot;@+id/bt_circularreveal_show&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:text=&quot;Start Circular Reveal&quot;/&gt;<br>    &lt;android.support.design.widget.FloatingActionButton<br>        android:id=&quot;@+id/fab_circlereveal_start&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        app:fabSize=&quot;normal&quot;<br>        app:useCompatPadding=&quot;true&quot;<br>        android:src=&quot;@drawable/ic_vibration_black_24dp&quot;<br>        /&gt;<br>    <br>&lt;/LinearLayout&gt;</strong></pre><p>activity.xml</p><pre>public class CircleRevealActivity extends AppCompatActivity implements View.OnClickListener {<br>    private Button btCircularRevealShow;<br><br>    private FloatingActionButton fabCircularReavalShow;<br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_circle_reveal</em>);<br>        setUpViews();<br>    }<br>    private void setUpViews() {<br>        btCircularRevealShow = (Button) findViewById(R.id.<em>bt_circularreveal_show</em>);<br>        <br>        fabCircularReavalShow = (FloatingActionButton) findViewById(R.id.<em>fab_circlereveal_start</em>);<br>        btCircularRevealShow.setOnClickListener(this);<br><br>    }<br>    @Override<br>    public void onClick(View view) {<br>        switch (view.getId()) {<br>            case R.id.<em>bt_circularreveal_show</em>:<br>                <strong>showCircularReveal();</strong><br>                break;<br>        }<br>    }<br>    private void <strong>showCircularReveal()</strong> {<br>        int cx = fabCircularReavalShow.getWidth() / 2;<br>        int cy = fabCircularReavalShow.getHeight() / 2;<br>        float finalRadius = Math.<em>max</em>(cx, cy);<br>        if (android.os.Build.VERSION.<em>SDK_INT </em>&gt;= android.os.Build.VERSION_CODES.<em>LOLLIPOP</em>) {<br>            Animator animator = <strong>ViewAnimationUtils.<em>createCircularReveal</em>(fabCircularReavalShow, cx, cy, 0, finalRadius);</strong><br>            animator.start();<br>            fabCircularReavalShow.setVisibility(View.<em>VISIBLE</em>);<br>        }<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*cuUj2M_bCvKPM7wqi4bEdg.png" /></figure><h4>To hide a previously visible view using this effect</h4><p>layout.xml</p><pre>&lt;LinearLayout<br>    &gt;<br>    <br>    &lt;Button<br>        android:id=&quot;@+id/bt_circularreveal_end&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>    &lt;android.support.design.widget.FloatingActionButton<br>        android:id=&quot;@+id/fab_circlereveal_end&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        app:fabSize=&quot;normal&quot;<br>        app:useCompatPadding=&quot;true&quot;<br>        android:src=&quot;@drawable/ic_vibration_black_24dp&quot;<br>        /&gt;<br>&lt;/LinearLayout&gt;</pre><p>Activity.java</p><pre>public class CircleRevealActivity extends AppCompatActivity implements View.OnClickListener {<br><br>    private Button btCircularRevealEnd;<br>    private FloatingActionButton fabCircularReavalEnd;<br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_circle_reveal</em>);<br>        setUpViews();<br>    }<br>    private void setUpViews() {<br>        btCircularRevealEnd = (Button) findViewById(R.id.<em>bt_circularreveal_end</em>);<br>        fabCircularReavalEnd = (FloatingActionButton) findViewById(R.id.<em>fab_circlereveal_end</em>);<br>        btCircularRevealEnd.setOnClickListener(this);<br>    }<br>    @Override<br>    public void onClick(View view) {<br>        switch (view.getId()) {<br>            case R.id.<em>bt_circularreveal_end</em>:<br>     <strong>           endCircularReaveal();</strong><br>                break;<br>        }<br>    }<br>    private void <strong>endCircularReaveal() </strong>{<br>        fabCircularReavalEnd.setVisibility(View.<em>VISIBLE</em>);<br>        int cx = fabCircularReavalEnd.getWidth() / 2;<br>        int cy = fabCircularReavalEnd.getHeight() / 2;<br>        float initialRadious = Math.<em>max</em>(cx, cy);<br>        if (Build.VERSION.<em>SDK_INT </em>&gt;= Build.VERSION_CODES.<em>LOLLIPOP</em>) {<br>            Animator animator = ViewAnimationUtils.<em>createCircularReveal</em>(fabCircularReavalEnd, cx, cy, initialRadious, 0);<br>            animator.addListener(new Animator.AnimatorListener() {<br>                @Override<br>                public void onAnimationStart(Animator animator) {<br>                }<br>                @Override<br>                public void onAnimationEnd(Animator animator) {<br>                    fabCircularReavalEnd.setVisibility(View.<em>INVISIBLE</em>);<br>                }<br>                @Override<br>                public void onAnimationCancel(Animator animator) {<br>                }<br>                @Override<br>                public void onAnimationRepeat(Animator animator) {<br>                }<br>            });<br>            animator.start();<br>        }<br>    }<br> <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*hXiISNU8f4qq6HeTwUerAg.png" /></figure><p>This is small program to understand the concept of the circular revel effect in material design.Do more complicated one then we will understand the more about this animations</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27e1306f0613" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/reveal-effect-in-material-design-27e1306f0613">Reveal Effect in material design</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Toasts in Android]]></title>
            <link>https://medium.com/android-app-development-for-beginners/toast-in-android-11890a4a6cc9?source=rss----5987d5bb5e60---4</link>
            <guid isPermaLink="false">https://medium.com/p/11890a4a6cc9</guid>
            <category><![CDATA[custom-toast]]></category>
            <category><![CDATA[position-toast]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[toast-in-android]]></category>
            <dc:creator><![CDATA[Yugandhar]]></dc:creator>
            <pubDate>Mon, 25 Jul 2016 10:44:04 GMT</pubDate>
            <atom:updated>2016-07-21T09:00:05.945Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/335/0*tnYGGPygL2JArjNE.png" /></figure><ul><li>A toast provides simple feedback about an operation in a small popup.</li><li>A toast is a view containing a quick little message for the user</li><li>It only fills the amount of space required for the message and the current activity remains visible and interactive.</li></ul><h4>Creating a Toast</h4><ul><li>First, instantiate a <a href="https://developer.android.com/reference/android/widget/Toast.html">Toast</a> object with one of the <a href="https://developer.android.com/reference/android/widget/Toast.html#makeText(android.content.Context,%20int,%20int)">makeText()</a> methods</li><li>This method takes three parameters: <a href="https://developer.android.com/reference/android/content/Context.html">Context</a>, text message, duration for the toast.</li></ul><pre>Toast.makeText(context, text, duration).show();</pre><pre><strong>Example</strong><br>Toast.makeText(getApplicationContext(),&quot;Hello Toast&quot;,Toast.SHORT_LENGTH).show();</pre><p>Simple code snippet for creating a toast</p><pre><strong>layout.xml</strong></pre><pre>&lt;LinearLayout<br>    android:orientation=&quot;vertical&quot;<br> tools:context=&quot;com.customizationtoastapp.CustomizationToastActivity&quot;&gt;<br>    &lt;Button<br>        android:id=&quot;@+id/bt_customizationToast&quot;<br>       android:text=&quot;Toast Customization&quot;/&gt;<br>&lt;/LinearLayout&gt;</pre><pre><strong>Activity.xml</strong></pre><pre>public class CustomizationToastActivity extends AppCompatActivity implements View.OnClickListener {<br>    private Button btCustomizationToast;<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_customization_toast</em>);<br>        setUpViews();<br>    }<br>    private void setUpViews() {<br>        btCustomizationToast = (Button) findViewById(R.id.<em>bt_customizationToast</em>);<br><br>        btCustomizationToast.setOnClickListener(this);<br>    }<br>    @Override<br>    public void onClick(View view) {<br>        switch (view.getId()) {<br>            case R.id.<em>bt_customizationToast</em>:<br>                Toast toast= Toast.<em>makeText</em>(getApplicationContext(),&quot;Hello&quot;,Toast.<em>LENGTH_SHORT</em>);<br>                toast.show();<br>                break;<br>        }<br>    }</pre><p>####OUTPUT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/0*KEvduBq3DATYEiYH.png" /></figure><h4>Positioning your Toast</h4><ul><li>A standard toast notification appears near the bottom of the screen, centered horizontally.</li><li>You can change this position with the <strong>setGravity(int, int, int) </strong>method.</li></ul><p>Use same layout we defined previously</p><pre><strong>Activity.java</strong><br>public class CustomizationToastActivity extends AppCompatActivity implements View.OnClickListener {<br>    private Button btCustomizationToast;<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_customization_toast</em>);<br>    <strong>    setUpViews();</strong><br>    }<br>    private void <strong>setUpViews() </strong>{<br>        btCustomizationToast = (Button) findViewById(R.id.<em>bt_customizationToast</em>);<br>        btCustomizationToast.setOnClickListener(this);<br>       <br>    }<br>    @Override<br>    public void onClick(View view) {<br>        switch (view.getId()) {<br>            case R.id.<em>bt_customizationToast</em>:<br>                Toast toast= 	Toast.<em>makeText</em>(getApplicationContext(),&quot;Hello&quot;,Toast.<em>LENGTH_SHORT</em>);<br>                <strong>toast.setGravity(Gravity.<em>START</em>|Gravity.<em>AXIS_CLIP</em>, 0, 500);</strong><br>                toast.show();<br>                break;<br>            <br>        }<br>    }<br>}</pre><p>###OUTPUT</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*wiozIu6y4IAN_RUw1EIUpw.png" /></figure><h4>Creating a Custom Toast View</h4><ul><li>Create a separate layout file for custom toast view</li><li>Use LayoutInflater for initializing the layout</li><li>set layout to Toast with the method setView(View)</li></ul><pre><strong>layout_custom_toast.xml</strong></pre><pre>&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>              android:orientation=&quot;vertical&quot;<br>              android:layout_width=&quot;match_parent&quot;<br>              android:layout_height=&quot;match_parent&quot;<br>    &gt;<br>&lt;TextView<br>    android:layout_width=&quot;wrap_content&quot;<br>    android:layout_height=&quot;wrap_content&quot;<br>    android:text=&quot;CustomToast&quot;<br>    android:textSize=&quot;30sp&quot;<br>    /&gt;<br>    &lt;ImageView<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:src=&quot;@drawable/ic_account_circle_black_24dp&quot;<br>        /&gt;<br>&lt;/LinearLayout&gt;</pre><pre><strong>actvity_layout.xml</strong></pre><pre>&lt;LinearLayout    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;    xmlns:tools=&quot;http://schemas.android.com/tools&quot;    android:orientation=&quot;vertical&quot;    <br>android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot;<br>    tools:context=&quot;com.customizationtoastapp.CustomizationToastActivity&quot;&gt;<br>    &lt;Button<br>        android:id=&quot;@+id/bt_customizationToast_layout&quot;<br>        android:layout_width=&quot;wrap_content&quot;<br>        android:layout_height=&quot;wrap_content&quot;<br>        android:text=&quot;Toast Customization layout&quot;/&gt;<br>&lt;/LinearLayout&gt;</pre><pre>Activity.xml</pre><pre>public class CustomizationToastActivity extends AppCompatActivity implements View.OnClickListener {<br><br>    private Button btCustomizationToastLayout;<br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.<em>activity_customization_toast</em>);<br>        setUpViews();<br>    }<br>    private void setUpViews() {<br>        btCustomizationToastLayout = (Button) findViewById(R.id.<em>bt_customizationToast_layout</em>);<br>        btCustomizationToastLayout.setOnClickListener(this);<br>    }<br>    @Override<br>    public void onClick(View view) {<br>        switch (view.getId()) {<br>            <br>            case R.id.<em>bt_customizationToast_layout</em>:<br>                setToastLayoutout();<br>                break;<br>        }<br>    }<br>    private void setToastLayoutout() {<br>        LayoutInflater layoutInflater = getLayoutInflater();<br>        View toastLayout = <strong>layoutInflater.inflate(R.layout.<em>layout_toast</em>, null);<br></strong>        Toast toast = new Toast(getApplicationContext());<br>       <strong> toast.setView(toastLayout);</strong><br>        toast.show();<br>    }<br>}</pre><p>####output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*cpAt8RamLkTbmLr7bRUEjw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11890a4a6cc9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-app-development-for-beginners/toast-in-android-11890a4a6cc9">Toasts in Android</a> was originally published in <a href="https://medium.com/android-app-development-for-beginners">Android App Development for beginners</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>