<?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 Ninganna Kuntoji on Medium]]></title>
        <description><![CDATA[Stories by Ninganna Kuntoji on Medium]]></description>
        <link>https://medium.com/@ninganna?source=rss-c0ed9b71eacb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gw3-CuhWX_nWDvCWzlmGWg.jpeg</url>
            <title>Stories by Ninganna Kuntoji on Medium</title>
            <link>https://medium.com/@ninganna?source=rss-c0ed9b71eacb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 21:08:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ninganna/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[Understanding Android Intents: A Comprehensive Guide]]></title>
            <link>https://ninganna.medium.com/title-understanding-android-intents-a-comprehensive-guide-cc09480ec1fc?source=rss-c0ed9b71eacb------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc09480ec1fc</guid>
            <category><![CDATA[implicit]]></category>
            <category><![CDATA[explicit]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[intent]]></category>
            <category><![CDATA[flags]]></category>
            <dc:creator><![CDATA[Ninganna Kuntoji]]></dc:creator>
            <pubDate>Fri, 29 Mar 2024 17:17:57 GMT</pubDate>
            <atom:updated>2024-03-29T17:25:49.948Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction:</strong></p><p>Android intents serve as the backbone of communication between various components within an Android application as well as between different applications. In this article, we’ll delve into the fundamentals of intents, exploring their types, and understanding explicit and implicit intents. Additionally, we’ll provide a detailed breakdown of flags used while starting an activity, accompanied by code snippets for better comprehension.</p><p><strong>What are Intents?</strong></p><p>Intents in Android are messaging objects that facilitate communication between different components such as activities, services, broadcast receivers, and the operating system itself. They enable the invocation of components within the same application or across different applications.</p><p><strong>Types of Intents:</strong></p><ol><li><strong>Implicit Intents:</strong> Implicit intents do not specify the target component’s class name explicitly. Instead, they declare the action to be performed, allowing the system to determine the appropriate component to handle the intent based on the available components that have registered to handle that action.</li><li><strong>Explicit Intents</strong>: These are used for invoking components within the same application by explicitly specifying the target component’s class name. Explicit intents are primarily used for internal communication within an application.</li></ol><p><strong>Implicit Intents:</strong></p><p>Implicit intents are versatile and can be used to perform various actions without specifying the exact component to handle them. Below are some common types of implicit intents along with examples of how they are used:</p><ol><li><strong>Viewing a Webpage</strong>: Implicit intent to view a webpage in a browser app</li></ol><pre>val webpage: Uri = Uri.parse(&quot;https://www.example.com&quot;)<br>val intent = Intent(Intent.ACTION_VIEW, webpage)<br>startActivity(intent)</pre><p>2. <strong>Sending Email:</strong> Implicit intent to compose an email</p><pre>val intent = Intent(Intent.ACTION_SENDTO).apply {<br>    data = Uri.parse(&quot;recipient@example.com&quot;)<br>    putExtra(Intent.EXTRA_SUBJECT, &quot;Subject&quot;)<br>    putExtra(Intent.EXTRA_TEXT, &quot;Body&quot;)<br>}<br>startActivity(intent)</pre><p>3. <strong>Sending SMS</strong>: Implicit intent to compose an SMS:</p><pre>val intent = Intent(Intent.ACTION_SENDTO).apply {<br>    data = Uri.parse(&quot;sms:&quot;)<br>    putExtra(&quot;sms_body&quot;, &quot;Message body&quot;)<br>}<br>startActivity(intent)</pre><p>4. <strong>Making a Phone Call:</strong> Implicit intent to initiate a phone call:</p><pre>val intent = Intent(Intent.ACTION_DIAL).apply {<br>    data = Uri.parse(&quot;tel:1234567890&quot;)<br>}<br>startActivity(intent)</pre><p><strong>Explicit Intents:</strong></p><p>Explicit intents are used when the target component is known and specified explicitly. They are typically used to launch components within the same application. Below is an example of how to create and use an explicit intent to start another activity:</p><pre>// Creating an explicit intent<br>val intent = Intent(this@CurrentActivity, TargetActivity::class.java)<br>startActivity(intent)</pre><p><strong>Detail of Flags While Starting an Activity:</strong></p><p>Flags are used to modify the behavior of an activity when it’s started. Here are some commonly used flags along with their descriptions:</p><ol><li><strong>FLAG_ACTIVITY_NEW_TASK</strong>: This flag is used to launch a new activity in a new task stack. If the activity already exists in the current task stack, it will be brought to the foreground.</li><li><strong>FLAG_ACTIVITY_CLEAR_TOP</strong>: This flag is used to clear the current task stack up to the target activity before launching the new activity. If the activity already exists in the task stack, all activities above it will be closed.</li><li><strong>FLAG_ACTIVITY_SINGLE_TOP</strong>: This flag is used in conjunction with FLAG_ACTIVITY_NEW_TASK or FLAG_ACTIVITY_CLEAR_TOP. It ensures that if the target activity is already at the top of the task stack, it won’t be recreated but instead will receive the onNewIntent() callback.</li><li><strong>FLAG_ACTIVITY_NO_HISTORY</strong>: This flag is used to exclude the activity from the activity stack. When the user navigates away from the activity, it will be finished and removed from the stack.</li><li><strong>FLAG_ACTIVITY_CLEAR_TASK</strong>: This flag is used to clear the entire task stack and launch the activity as the new root activity.</li></ol><p>These flags can be combined using the <strong>or</strong> to achieve desired behavior. For example:</p><pre>val intent = Intent(this@CurrentActivity, TargetActivity::class.java)<br>intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK<br>startActivity(intent)</pre><p><strong>Conclusion</strong>:</p><p>Android intents are essential for facilitating communication and interaction between different components within an Android application as well as between different applications. Understanding the types of intents, explicit and implicit, along with the various flags used while starting activities, is crucial for developing robust and efficient Android applications. With the knowledge gained from this guide, developers can leverage intents effectively to enhance the user experience and functionality of their Android applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc09480ec1fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android — Activity Life Cycle]]></title>
            <link>https://ninganna.medium.com/android-activity-life-cycle-5c9b6d427d73?source=rss-c0ed9b71eacb------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c9b6d427d73</guid>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[activity]]></category>
            <category><![CDATA[os]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Ninganna Kuntoji]]></dc:creator>
            <pubDate>Thu, 28 Sep 2023 14:47:46 GMT</pubDate>
            <atom:updated>2023-09-28T14:47:46.981Z</atom:updated>
            <content:encoded><![CDATA[<p>Android — Activity Life Cycle</p><p>Hello everyone, I’m thrilled to introduce myself as Ninganna Kuntoji, an accomplished Android developer with four years of invaluable experience in the field. Currently, I’m proudly contributing to the dynamic team at Zolo Stays.</p><p>Today, we embark on a journey into the heart of Android development, focusing on a topic that serves as the cornerstone of your journey: the Android lifecycle. This is undeniably the most crucial subject to grasp as you begin your exciting voyage into the world of Android app development. So, let’s dive in and unlock the mysteries of the Android lifecycle!</p><p>But before that, What is Android…?</p><p>It’s the<strong> operating system </strong>inside<strong> 2.5 billion active devices</strong>. From 5G phones to stunning tablets, Android powers them all.</p><p>But, What is operating system...?</p><p>An operating system (OS) is the program that, after being initially loaded into the device(can be computer, mobile, raspbery Pi) by a boot program, manages all of the other application programs in the device. There are lot of concepts regarding OS which we can over some other day. (Stay tune for that)</p><p>So to conclude, Android OS is a <strong>Linux-based </strong>mobile operating system that primarily runs on smartphones and tablets.</p><p>Before life cycle of activity let’s see what is activity…?</p><p>An activity is similiar to a window on your computer screen, serving as a fundamental building block of your Android app’s user interface. To put it in perspective, consider the Contacts app on your phone; the screen displaying your contact list can be referred to as the “ContactsActivity.” (Stay tuned for future blogs, where we’ll deep dive into naming conventions and clean code architecture principles to further refine your app development skills.)</p><p><strong>Let’s deep dive into Activity life cycle now…</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*aL1Wm-K_EebgTtHyGaSN0A.png" /><figcaption>Source : <a href="https://developer.android.com/guide/components/activities/activity-lifecycle">https://developer.android.com/guide/components/activities/activity-lifecycle</a></figcaption></figure><p>You should have seen this image a lot of times whenever you search for activity life cycle, so we’ll also be referring the above image and explain each methods in detail.</p><p>Activity life cycle means the phases of the activity is going through from start to end</p><ol><li><strong>OnCreate()</strong> — It’s the first method that gets called when you start any activity from anywhere maybe it’s from tapping the app icon from the app drawer or navigating from one activity to another. <br>You can define the UI, get the UI elements from xml file of respective activity, data, screen settings, data from previous activity which we call as Intent.</li><li><strong>OnStart() — </strong>After OnCreate() app enters in OnStart() phase/method it ensures everything before starting the UI. We can do some tasks here such as starting a background service, Registering broadcasts. It is a quick process and then control goes to OnResume() quickly</li><li><strong>OnResume() </strong>— We can use this method if the API call is essential for the activity’s functionality and update the UI as per data you receieved from the API.<br>Acquire resources or start tasks necessary for user interaction.(Example: Camera, Location, etc) and should release in OnPause() otherwise whenever you are back from an activity it’ll again register</li><li><strong>OnPause() </strong>— It’s triggered when you press back/home button of the device. In this app saves the current state of the screen so that it should retain it’s state when it’s back. We should release the resources that we have registered in OnResume() so that resource should not be active in the background which can cause battery drainage, memory leaks, etc…</li><li><strong>OnStop() </strong>— It is called when the activity is transitioning from being partially visible (e.g., in the background) to being completely invisible. It’s a clear indication that the activity is no longer in the foreground and is not interacting with the user.</li><li><strong>OnDestroy() </strong>— method is called when an activity is being destroyed. This can happen for a number of reasons, such as:<br>a. The user has finished using the activity and pressed the back button.<br>b. The activity has been finished programmatically by calling the finish() method.<br>c. The system is low on memory and needs to reclaim resources.</li><li><strong>OnRestart() </strong>— By name it’s saying that whenever user returns to the activity onRestart() will be called and we can restart the tasks which are not completed or resume the tasks. For example Imagine you are developing a music player app. The user is listening to a song and then presses the home button to go to the home screen. The user then taps on the music player app icon to return to the app.<br>The onRestart() method is called on the music player activity when it comes back to the foreground. You could use this method to resume playing the song that the user was listening to before they left the app.</li></ol><p>We have thoroughly explored the various lifecycle methods and their definitions, ensuring a comprehensive understanding of this crucial topic. It’s my hope that you now have a clear grasp of the purpose and usage of each method.</p><p>In our upcoming blog, we will delve into specific lifecycle phases within various scenarios. For instance, we’ll discuss what transpires when you receive a phone call, or when you navigate between different activities. Stay tuned for these insightful discussions. Thank you for reading the blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c9b6d427d73" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>