<?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 RajaReddy PolamReddy on Medium]]></title>
        <description><![CDATA[Stories by RajaReddy PolamReddy on Medium]]></description>
        <link>https://medium.com/@rajareddypolamreddy?source=rss-a42915d01b2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3ZsQr8XVIVK3IiWj.jpg</url>
            <title>Stories by RajaReddy PolamReddy on Medium</title>
            <link>https://medium.com/@rajareddypolamreddy?source=rss-a42915d01b2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:03:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajareddypolamreddy/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[Activity Launch Modes in Android]]></title>
            <link>https://medium.com/@rajareddypolamreddy/activity-launch-modes-in-android-888cb8801932?source=rss-a42915d01b2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/888cb8801932</guid>
            <category><![CDATA[launch-mode]]></category>
            <category><![CDATA[activity]]></category>
            <category><![CDATA[manifest-launch-mode]]></category>
            <dc:creator><![CDATA[RajaReddy PolamReddy]]></dc:creator>
            <pubDate>Mon, 20 Mar 2023 11:12:01 GMT</pubDate>
            <atom:updated>2023-03-20T11:18:13.826Z</atom:updated>
            <content:encoded><![CDATA[<p>There are four launch modes for the activity.</p><ol><li>standard</li><li>singleTop</li><li>singleTask</li><li>singleInstance</li></ol><blockquote><strong>1. Standard: </strong>This is the default launch mode of activity. If you don’t set any launch mode for your activity, it will use the standard mode <strong>by default</strong>. It creates a new instance of activity every time even if the activity instance is already present.</blockquote><p><strong><em>Ex:</em></strong> Suppose we have A, B, C, and D activities and your activity B has <strong>standard</strong> launch mode. Now again launching activity B</p><p>State of Activity Stack before launch B</p><p>A →B→ C→D</p><p>State of Activity Stack after launch B</p><p>A → B → C→D→ B</p><p>We can see that a new instance of B is created again.</p><blockquote><strong>2. SingleTop: </strong>Suppose an instance of the activity already exists at the top of the current task. In that case, a new instance will not be created and the Android system will route the intent information through <strong>onNewIntent()</strong>.<br>If an instance is not present on <strong>top</strong> of the task then a new instance will be created.</blockquote><p><strong>Ex:</strong> Suppose we have A, B, C, and D activities. <strong>A →B →C →D</strong></p><p>If we launch C then a new instance of C will be created as <strong>it is not on top</strong>.<br>So it will look like A →B →C →D →C</p><p>Now suppose we have A →B →C →D →C like this<br>then we again launch C activity then in this case new instance will not be created. Instead, we will receive the callback on the <strong>onNewIntent() </strong>method.</p><blockquote><strong>3. SingleTask: </strong>An activity declared with launch mode as <strong>singleTask </strong>can have <strong>only one instance in the system</strong> (singleton). At a time only one instance of activity will exist.</blockquote><blockquote>If an activity instance is not present then the new instance will be created and if the instance is already present in the system then the <strong>onNewIntent()</strong> method will receive the callback.</blockquote><p><strong>Ex:</strong> Suppose we have A, B, and C activities(<strong>A →B →C ) </strong>and we are launching D which has a singleTask launch mode. In that case, the new instance of D will be created so the current state will look like this. (<strong>A →B →C →D)</strong></p><p>Let&#39;s suppose we launch B which also has a <strong>singleTask</strong> launch mode then the current state will look like this.</p><p><strong>A →B</strong></p><p>The here old instance gets called and intent data is routed through the <strong>onNewIntent()</strong> callback. Also, notice that <strong>C and D activities get destroyed</strong> here.</p><blockquote><strong>4. SingleInstance: </strong>It is similar to singleTask except that no other activities will be created in the same task. If another Activity is called from this kind of Activity, a new Task would be automatically created to place that new Activity.</blockquote><h4>Case 1:</h4><p>Suppose you have A, B, and C activities(<strong>A →B →C)</strong> and your activity D has a <strong>singleInstance</strong> launch mode. In this case, if we launch D then D will be launched in a different task. A new task for D will be created.</p><p>Task1: <strong>A →B →C</strong></p><p>Task2 : D (<strong>here D will be in a different task</strong>)</p><p>Now if you continue this and start E from D then Stack will look like</p><p>Task1: <strong>A →B →C →E</strong></p><p>Task2: D</p><h4>Case 2:</h4><p>Suppose you have A, B, and C activities in<strong> one task</strong> (<strong>A →B →C</strong>)and activity D is in <strong>another task</strong> with launch mode <strong>singleInstance</strong>. In this case, if we launch D again then we will receive the callback in the <strong>onNewIntent()</strong> method of D activity.</p><p>Task1: <strong>A →B →C</strong></p><p>Task2: D (Here old instance gets called and intent data is routed through <strong>onNewIntent()</strong> callback)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=888cb8801932" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>