<?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 Aryan Dhankar on Medium]]></title>
        <description><![CDATA[Stories by Aryan Dhankar on Medium]]></description>
        <link>https://medium.com/@EliteNovice?source=rss-a53917d9c346------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kqSGf1jsUmfWPebmFXMcHg.jpeg</url>
            <title>Stories by Aryan Dhankar on Medium</title>
            <link>https://medium.com/@EliteNovice?source=rss-a53917d9c346------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 06:54:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@EliteNovice/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[ 5 Books That’ll Instantly Level Up How You Think as a Developer]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/mindorks/5-books-thatll-instantly-level-up-how-you-think-as-a-developer-c73203b67775?source=rss-a53917d9c346------2"><img src="https://cdn-images-1.medium.com/max/2600/0*ZsT3r3mV6YLvFnay" width="3936"></a></p><p class="medium-feed-snippet">&#x1F9E0; You can learn syntax from tutorials&#x200A;&#x2014;&#x200A;but these books teach you how to think like a true software craftsman.</p><p class="medium-feed-link"><a href="https://medium.com/mindorks/5-books-thatll-instantly-level-up-how-you-think-as-a-developer-c73203b67775?source=rss-a53917d9c346------2">Continue reading on MindOrks »</a></p></div>]]></description>
            <link>https://medium.com/mindorks/5-books-thatll-instantly-level-up-how-you-think-as-a-developer-c73203b67775?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/c73203b67775</guid>
            <category><![CDATA[books]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[book-recommendations]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 06:13:34 GMT</pubDate>
            <atom:updated>2025-11-17T06:13:34.290Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How I Stopped Overthinking and Finally Started Learning]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@EliteNovice/how-i-stopped-overthinking-and-finally-started-learning-e6eb36cc168f?source=rss-a53917d9c346------2"><img src="https://cdn-images-1.medium.com/max/2600/0*Potdf5UeXFhHDXBs" width="5304"></a></p><p class="medium-feed-snippet">&#x1F331; Learning Hurts&#x200A;&#x2014;&#x200A;But That&#x2019;s Exactly How You Grow</p><p class="medium-feed-link"><a href="https://medium.com/@EliteNovice/how-i-stopped-overthinking-and-finally-started-learning-e6eb36cc168f?source=rss-a53917d9c346------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@EliteNovice/how-i-stopped-overthinking-and-finally-started-learning-e6eb36cc168f?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6eb36cc168f</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Mon, 03 Nov 2025 08:21:37 GMT</pubDate>
            <atom:updated>2025-11-03T08:21:37.208Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How does the ForeGround Service be worthy enough to Stay alive in Background, and normal Service…]]></title>
            <link>https://medium.com/walkinthecode/how-does-the-foreground-service-be-worthy-enough-to-stay-alive-in-background-and-normal-service-b287bdf36df6?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/b287bdf36df6</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[médium]]></category>
            <category><![CDATA[services]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Sun, 16 Aug 2020 13:09:48 GMT</pubDate>
            <atom:updated>2020-08-16T13:09:48.093Z</atom:updated>
            <content:encoded><![CDATA[<h3>How does the ForeGround Service be worthy enough to Stay alive in Background, and normal Service not…?</h3><h4>Let’s explore the magic behind it.</h4><p>If we listen, what official android <a href="https://developer.android.com/guide/components/services"><strong>doc</strong></a> has to say over the topic.</p><p><strong>Foreground Service:</strong> A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. Foreground services must display a <a href="https://developer.android.com/guide/topics/ui/notifiers/notifications.html">Notification</a>. Foreground services continue running even when the user isn’t interacting with the app.</p><p><strong>Background</strong> <strong>Service:</strong> A background service performs an operation that isn’t directly noticed by the user. For example, if an app used a service to compact its storage, that would usually be a background service.</p><p>Note:- If your app targets API level 26 or higher, the system imposes <a href="https://developer.android.com/about/versions/oreo/background.html">restrictions on running background services</a> when the app itself isn’t in the foreground</p><p>So from the above explanation, we could conclude, that if our app is targets above and equal to API level 26 and if we want to do some work when the user is not interacting with the app, then we have gone for ForeGround Services.</p><p>So what different we have to create a foreground service. No don’t worry too much, we just have to add this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5be5409c61395124bc485103352d615/href">https://medium.com/media/b5be5409c61395124bc485103352d615/href</a></iframe><p>So just by adding <br>startForeground(ONGOING_NOTIFICATION_ID, notification), android allows us to run a service that exists even after our app got killed.</p><p>Now I will explain how does StartForeground, makes Service worthy enough to run in the background.</p><p>Here I am going to relate this topic with the story of Mjolnir(hammer of thor)</p><p>Everyone is a simple person, but if any ordinary person is worthy to wield the hammer, then posses all the powers of thor.</p><p>Similarly, every service is ordinary service, but if the service is worthy, to lie in the Foreground Process, then it can run in the background even if the app kills.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlPXvWBGEo5eQScItDN%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FlPXvWBGEo5eQScItDN%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FlPXvWBGEo5eQScItDN%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/6583d41e8cfba9a163c18ed06d64d2fc/href">https://medium.com/media/6583d41e8cfba9a163c18ed06d64d2fc/href</a></iframe><p>So to understand, what does it mean to lie in the Foreground Process, we have to understand what is a process and its lifecycle</p><h3>Processes</h3><p>By default, all components of the same application run in the same process, and most applications should not change this. However, if you find that you need to control which process a certain component belongs to, you can do so in the manifest file.</p><p>The manifest entry for each type of component element — <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/manifest/activity-element.html">&lt;activity&gt;</a>, <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/manifest/service-element.html">&lt;service&gt;</a>, <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a>, and <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/manifest/provider-element.html">&lt;provider&gt;</a>—supports an android:process the attribute that can specify a process in which that component should run. You can set this attribute so that each component runs in its own process, or so that some components share a process while others do not. You can also set android:process so that components of different applications run in the same process—provided that the applications share the same Linux user ID and are signed with the same certificates.</p><p>The <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/topics/manifest/application-element.html">&lt;application&gt;</a> element also supports an android:process attribute, to set a default value that applies to all components.</p><p>Android might decide to shut down a process at some point when memory is low and required by other processes that are more immediately serving the user. Application components running in the process that’s killed are consequently destroyed. The decision of whether to terminate a process, therefore, depends on the state of the components running in that process. The rules used to decide which processes to terminate is discussed below.</p><p>Note:- If a person wields the hammer, that doesn’t he/she can’t get killed, like cap after wielding Mjolnir he was to able to stand against Thanos and fight with him up to some level, but in the end, he failed and his shield also got destroyed. Similarly, if a Service belongs to the Foreground process, that means it can run in the background even after the app gets killed, but if android wants to recover memory then service would be terminated by the os.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FVdQmSNvWvrvLZsbZkE%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FVdQmSNvWvrvLZsbZkE%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FVdQmSNvWvrvLZsbZkE%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="182" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ed9602295e63fdfc6db9ec3645b3334/href">https://medium.com/media/8ed9602295e63fdfc6db9ec3645b3334/href</a></iframe><p>So to understand which process got killed first and whose chance is last, we have to understand the process lifecycle…</p><h3>Process lifecycle</h3><p>The Android system tries to maintain an application process for as long as possible but eventually needs to remove old processes to reclaim memory for new or more important processes. To determine which processes to keep and which to kill, the system places each process into an “importance hierarchy” based on the components running in the process and the state of those components. Processes with the lowest importance are eliminated first, then those with the next lowest importance, and so on, as necessary to recover system resources.</p><p>There are five levels in the importance hierarchy. The following list presents the different types of processes in order of importance (the first process is <em>most important</em> and is <em>killed last</em>):</p><p><strong>Foreground process</strong></p><p>A process that is required for what the user is currently doing. A process is considered to be in the foreground if any of the following conditions are true:</p><ul><li>It hosts an <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html">Activity</a> that the user is interacting with (the <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html">Activity</a>&#39;s <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html#onResume()">onResume()</a> the method has been called).</li><li>It hosts a <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html">Service</a> that&#39;s bound to the activity that the user is interacting with.</li><li>It hosts a <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html">Service</a> that&#39;s running &quot;in the foreground&quot;—the service has called <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html#startForeground(int,%20android.app.Notification)">startForeground()</a>.</li><li>It hosts a <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html">Service</a> that&#39;s executing one of its lifecycle callbacks (<a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html#onCreate()">onCreate()</a>, <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html#onStart(android.content.Intent,%20int)">onStart()</a>, or <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html#onDestroy()">onDestroy()</a>).</li><li>It hosts a <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/content/BroadcastReceiver.html">BroadcastReceiver</a> that&#39;s executing its <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/content/BroadcastReceiver.html#onReceive(android.content.Context,%20android.content.Intent)">onReceive()</a> method.</li></ul><p><strong>Visible process</strong></p><p>A process that doesn’t have any foreground components, but still can affect what the user sees on the screen. A process is considered to be visible if either of the following conditions is true:</p><ul><li>It hosts an <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html">Activity</a> that is not in the foreground but is still visible to the user (its <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html#onPause()">onPause()</a> method has been called). This might occur, for example, if the foreground activity started a dialog, which allows the previous activity to be seen behind it.</li><li>It hosts a <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Service.html">Service</a> that&#39;s bound to a visible (or foreground) activity.</li></ul><p>A visible process is considered extremely important and will not be killed unless doing so is required to keep all foreground processes running.</p><p><strong>Service process</strong></p><p>A process that is running a service that has been started with the <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/content/Context.html#startService(android.content.Intent)">startService()</a> method and does not fall into either of the two higher categories. Although service processes are not directly tied to anything the user sees, they are generally doing things that the user cares about (such as playing music in the background or downloading data on the network), so the system keeps them running unless there&#39;s not enough memory to retain them along with all foreground and visible processes.</p><p><strong>Background process</strong></p><p>A process holding an activity that’s not currently visible to the user (the activity’s <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/reference/android/app/Activity.html#onStop()">onStop()</a> the method has been called). These processes have no direct impact on the user experience, and the system can kill them at any time to reclaim memory for a foreground, visible, or service process. Usually, there are many background processes running, so they are kept in an LRU (least recently used) list to ensure that the process with the activity that was most recently seen by the user is the last to be killed. If an activity implements its lifecycle methods correctly, and saves its current state, killing its process will not have a visible effect on the user experience, because when the user navigates back to the activity, the activity restores all of its visible state. See the <a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/components/activities.html#SavingActivityState">Activities</a> document for information about saving and restoring state.</p><p><strong>Empty process</strong></p><p>A process that doesn’t hold any active application components. The only reason to keep this kind of process alive is for caching purposes, to improve startup time the next time a component needs to run in it. The system often kills these processes in order to balance overall system resources between process caches and the underlying kernel caches.</p><p><strong>Conclusion</strong>:</p><p>Foreground Services lies in the first process i.e in Foreground Process. This means they are killed only as a last resort — if memory is so low that they cannot all continue to run.</p><p><strong>Key Points to Remember before using Foreground Service:</strong></p><ol><li>If your work is non-deferrable, then go for ForeGround Services.</li><li>Don’t do heavy operations on Foreground Service. If you want to do some heavy operation create sperate threads to get your work done.</li><li>The options you can use to create a thread (or threads ) in Foreground Service are AsyncTask, Threadpool, Coroutines, Rxjava.</li><li>ForeGround Service can last long in action even if our app is not live. But if the OS is low on memory then ForeGround Service can also get killed.</li><li>We don’t always have to choose ForeGround Service to do background tasks, we have lots of other options too, but we have to understand which one is best for what conditions.</li></ol><p>References:</p><ol><li><a href="https://stuff.mit.edu/afs/sipb/project/android/docs/guide/components/processes-and-threads.html">Processes and threads</a></li><li><a href="https://developer.android.com/guide/components/services">Foreground Services</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b287bdf36df6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/walkinthecode/how-does-the-foreground-service-be-worthy-enough-to-stay-alive-in-background-and-normal-service-b287bdf36df6">How does the ForeGround Service be worthy enough to Stay alive in Background, and normal Service…</a> was originally published in <a href="https://medium.com/walkinthecode">WalkInTheCode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LinkedIn Integration with v2 in Android using Rest API]]></title>
            <link>https://medium.com/walkinthecode/linkedin-integration-with-v2-in-android-using-rest-api-9face97b7525?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/9face97b7525</guid>
            <category><![CDATA[linkedin]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Thu, 25 Jul 2019 10:18:50 GMT</pubDate>
            <atom:updated>2019-07-26T04:43:12.793Z</atom:updated>
            <content:encoded><![CDATA[<h3>Who should read?</h3><p>if you are trying to integrate Linkedin login in 2019 and you have no clue where to go, then this article is for you. Here I will help to integrate Linkedin sign in step by step.</p><h3>Benefits of this post</h3><ul><li>You can email id of the member.</li><li>You can also fetch profile image</li><li>You can also fetch country, Locale of the member</li><li>easy to integrate</li></ul><h3>Note:-</h3><p>Now LinkedIn does not support TLS 1.0. You must use TLS 1.1 or 1.2 when calling LinkedIn APIs. All API requests to api.linkedin.com must be made over HTTPS. Calls made over HTTP will fail.</p><h3>Step 1:-Application Creation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3OEdrQlVx9bSQfp67_DLA.png" /></figure><p>So first we have to create an Application on LinkedIn, so that go to <a href="https://www.linkedin.com/developers/apps?source=post_page---------------------------"><strong>My Apps</strong></a><strong>, </strong>now click on Create App button. This will redirect you on the Crete App page where you have to fill all the details, as per your requirement and the hit on create app button, your app will be created with<strong> a Client ID</strong> and <strong>Client Secret</strong>.</p><h3>Authorizing Permissions</h3><p>According to LinkedIn’s <a href="https://docs.microsoft.com/en-us/linkedin/shared/authentication/permissions?context=linkedin%2Fcontext&amp;source=post_page---------------------------">permissions page</a>, there are two kinds:</p><ul><li>Member Authorization: Your application works with member account data to make requests on their behalf.</li><li>Application Authorization: Your application accesses LinkedIn APIs that are not member specific.</li></ul><p>As we see in the below image, we can have your Client ID and Client Secret from Auth Section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xq8F0vKDeJz53RYPNjHfMA.png" /></figure><h3>Step 2:-Create Authentication Url( Authenticating Members)</h3><p>New members logging in to your service for the first time will need to follow the <a href="https://docs.microsoft.com/en-us/linkedin/shared/authentication/authentication?context=linkedin/consumer/context">Authenticating with OAuth 2.0 Guide</a>. When requesting an authorization code in Step 2 of the OAuth 2.0 Guide, make sure to request the r_liteprofile and/or r_emailaddress scopes!</p><p><strong>Url format:-</strong> https://www.linkedin.com/oauth/v2/authorization?response_type=code&amp;client_id=YOUR_CLIENT_ID&amp;redirect_uri=YOUR_REDIRECT_URL&amp;state=aRandomString&amp;scope=r_liteprofile%20r_emailaddress%20w_member_social</p><p><strong>Original url</strong>-&gt; <a href="https://www.linkedin.com/oauth/v2/authorization?">https://www.linkedin.com/oauth/v2/authorization</a></p><p><strong>Parameters</strong>:</p><ul><li><strong>response_type</strong> -&gt; when have to pass “code” in this field</li><li><strong>client_id </strong>-&gt; your client id from LinkedIn app.</li><li><strong>redirect_uri</strong> -&gt; here you have to create your own URI, so that when we will get our auth token, we will be redirected to this URI.</li><li><strong>state</strong> -&gt; it could be any random string, example XYZ.</li><li><strong>scope </strong>-&gt; This is <strong>recommended </strong>by Linkedin itself if you want to get the <strong>profile information </strong>of the <strong>user</strong>. So pass this “r_liteprofile%20r_emailaddress%20w_member_social” in scope parameter. for more info about the scope, you can read from here.</li></ul><h3>Step 3:-Get Authentication code</h3><p>Now we have to load this URL in Webview and it will return you a code called authentication code. we will get it in the overridden method of Webview i.e</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9020393bb3891421c4bfa6fcb5e4d8d/href">https://medium.com/media/a9020393bb3891421c4bfa6fcb5e4d8d/href</a></iframe><p>here we will get authorization code— <strong>String authorizationToken = uri.getQueryParameter(RESPONSE_TYPE_VALUE);</strong></p><h3>Step 4:-Create Access Token Url and get access token</h3><p>after getting authorization code we have to get access token. for that, we have to create access token url as we can see in the above code</p><p>//Generate URL for requesting Access Token</p><p><strong>String accessTokenUrl = getAccessTokenUrl(authorizationToken);</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0dcb33a7b1f8728c493b55f640a73f53/href">https://medium.com/media/0dcb33a7b1f8728c493b55f640a73f53/href</a></iframe><p>now we have to hit this url and in response, we will get our access token. I am calling <strong>PostRequestAsyncTask </strong>to hit this url like this…</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/263f9ff266f4651f9223b470e7dd5647/href">https://medium.com/media/263f9ff266f4651f9223b470e7dd5647/href</a></iframe><h3>Step 5:- Get Profile Information of user, using Access Token</h3><p>Now we have to get member information so for that I have called GetProfileRequestAsyncTask to fetch data. I am calling below method from my async task.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7a7a24d3205c063e1a613dfe9aae14b/href">https://medium.com/media/d7a7a24d3205c063e1a613dfe9aae14b/href</a></iframe><ul><li><strong>Note -&gt; </strong>to fetch email id of user we have a separate method <strong>sendGetRequestForEmail(), </strong>you can see its code below</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62cdd2061115c66c2665065d15c05fe7/href">https://medium.com/media/62cdd2061115c66c2665065d15c05fe7/href</a></iframe><p>Hurray!! now we have complete profile information of the user.</p><p>Below I have written the all above code in single Activity.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f90049b1ffd88b62a4f239c28409b23/href">https://medium.com/media/7f90049b1ffd88b62a4f239c28409b23/href</a></iframe><p><strong>If you face any problem in integration feel free to contact me</strong></p><p><em>If you like my hard work and effort, you can do one clap, two claps or maybe forty…</em></p><p>You can also find me on...</p><p>GitHub, <a href="https://www.facebook.com/aryan.dhankar.3?source=post_page---------------------------">Facebook</a>, Quora, <a href="https://twitter.com/elite_novice?source=post_page---------------------------">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9face97b7525" width="1" height="1" alt=""><hr><p><a href="https://medium.com/walkinthecode/linkedin-integration-with-v2-in-android-using-rest-api-9face97b7525">LinkedIn Integration with v2 in Android using Rest API</a> was originally published in <a href="https://medium.com/walkinthecode">WalkInTheCode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Greedy algorithm ( Fractional Knapsack problem )]]></title>
            <link>https://medium.com/walkinthecode/greedy-algorithm-fractional-knapsack-problem-9aba1daecc93?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aba1daecc93</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Wed, 22 May 2019 11:52:51 GMT</pubDate>
            <atom:updated>2019-05-23T05:05:36.557Z</atom:updated>
            <content:encoded><![CDATA[<p>T he greedy algorithm, actually it’s not an algorithm it is a technique with the which we create an algorithm to solve a particular problem. So as its name suggests we have to greedy about the choice that we made, which seems best for that moment, regardless of the fact the choice we made right would turn out to be the worst choice.As</p><p>Today we will understand how greedy really works, and how we break items for maximizing the total value of knapsack problem.</p><p>First, we have to understand, what is knapsack and what really this knapsack problem is?.</p><p>So knapsack means bag. And the problem statement of the knapsack problem is like this…</p><p>We have some objects, that you want to import for us to India to sell. And object can be fractional means could be choose in fractional format.If we sell some units of an object in the Indian market we will get some amount of profit form that object</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*vSZ4XLHFFoBQ7ezKZdxqFg.png" /><figcaption>image 1</figcaption></figure><p>So now as shown in the above image if we sell 18 units of object1, we will get a profit of 25 in the Indian market. The same logic applies to the remaining two objects like for object 2 if weight is 15 units the profit will be 24. But the moment we have reach airport with our objects we came to know that, we have some limitation in luggage transportation at the airport,and we are allowed only to take a bag with us of max 20 units of wight max.</p><p>Now we have to arrange objects in our bag in such a way that when we sell the objects in Indian market we will get maximum profit out of it.</p><p>So we will try different approaches to solve this problem. Here we will use the greedy technique to find the solution.</p><ol><li>First Approach (Greedy about profit):- First, approach of every single person would be greedy about profit. Since I want to maximize the profits, I will take the objects which can give maximum profit. Therefore it seems, if we take object1 (profit — 25 ) first and put it in the bag, then we would get the max profit right. So after adding, let’s see what happens.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*9M7Y0pSLZnMnzukbv01nxg.png" /><figcaption>image 2</figcaption></figure><p>As we can see in the above picture if we took object1 (whose weight is 18 unit and profit of 18 units is 25,) and put it in the bag. Now the weight that remains in the bag is 2 units. So the next item with the maximum profit available is object2 whose profit is 24, only if, we put 15 units of weight. But we don’t have enough space left in the bag.</p><p>So if I put 15 u — — — I will get the profit of — — — — 24 of object2</p><p>but bag is only left with 2 unit of space</p><p>so for 2 u — — — — I will get the profit of — — — — (24/15)*2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*3baiqKnVz2bZAVPi-5119Q.png" /><figcaption>image 3</figcaption></figure><p>So as we went greedy about profit, then after filling the bag completely we have got profit 28.2. So is this the best possible solution?. Or Is there is any other method which we can apply and get the maximum profit out of it. Let’s observe that…</p><p>This time we will try to put as many as objects in the bag to maximize the profit. so for that, we will take the object which will be having the least weight, and we should put it first. So that bag would b filled with as many as objects. Therefore this time we are greedy about weights.</p><p>2. Second Approach (Greedy about Weight):- This time we have to choose the object with the least weight and that is object3. Therefore we will put object3 first whose weight is 10 as shown in the below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*ajjYBVBU9KtUZDQAN2pfkQ.png" /><figcaption>image 4</figcaption></figure><p>Now after putting object3, the bag still has 10 units of weight remaining. Now next object with the least weight is object2. So now we are going to put object2 in the bag, but we can’t pul all the 15 units of weight because only 10 units of wight are available in the bag. So just like we did before….</p><p>So if I put 15 u — — — I will get the profit of — — — — 24 of object2</p><p>But if I have only 10 u — — — — I will get the profit of — — — — (24/15)*10</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*JnQszQMooFp9-zwHE9lRRw.png" /><figcaption>image 5</figcaption></figure><p>This time we got total profit is 31. This time profit is more than when we were greedy about profits. It is not applicable for all the instances, only for this problem, we are getting more profit if we go greedy for weight rather than greedy for profit.</p><p>But still, we are not sure that the last total is the best possible solution to our problem. So what could be other property for which we would be greedy about for maximum profit? So now we won’t either by profits or by weights. This time we will go by the <strong>ratio of profit/weight (Fraction Knapsack)</strong>.</p><p>obj1 obj2 obj3</p><p>p/w</p><p>object 1 — (25/18) = 1.4</p><p>object2 — (24/15) =1.6</p><p>object3 — (15/10) =1.5</p><p>Now we feel that the one with the maximum profit per unit, that has to be placed in the knapsack. So first object to be placed is object2 and then object3 as shown in the below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*1sd3P2d_Ytm39yekzb10OA.png" /><figcaption>image 6</figcaption></figure><p>This time we get the profit is 31.5. This is true for all instances, so whenever we try to find the profit per unit weight ratio and then place the object which has the max p/w ratio. we will always get the maximum profit.</p><p><strong>Now we will talk about its algorithm, and also analyze the time complexity </strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c87cbbb90135db5a3479fd17346589b8/href">https://medium.com/media/c87cbbb90135db5a3479fd17346589b8/href</a></iframe><p>So above code is the iterative version of the algorithm. One more thing that i want to that if a program can be implement using iteration, we could implement the same program using recursion and vice-versa. But most of the time if we go for recursion we might have to use a recursive stack, because of which space taken for such recursive program might be bigger. Writing a recursive program is simpler but while executing it space taken might me more than to iterative versions.</p><p>Let’s implement the algorithm with the following example</p><p>m=15 , n=7</p><p>Objects 1 2 3 4 5 6 7</p><p>Profits 10 5 15 7 6 18 3</p><p>Weights 2 3 5 7 1 4 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*UZXw4nqCqxtm0H9oVquoHQ.png" /><figcaption>image 7</figcaption></figure><p>now objects are given as shown in the above image and they are saying that (capacity of knapsack is ) m=15 and (number of objects are ) n=7, and every object has profit and weights.</p><p>so we will go with the algorithm.</p><p>So step 1 of the algorithm is … for i=1 to n, where n means the number of objects. In given example, we have 7 objects. So we have to iterate from 1 to 7 and for each iteration, we have to compute (profit and weight ratio) pi/wi which is step 2 of algo.</p><p>Now we will go to step3 of algo, that is sort objects in non-increasing order of p/w like object no (5,1,6,3,7,2,4). also shown in the image7.</p><p>Now, step4 is <strong>for i=1 to n. { if(m&gt;0)&amp;&amp;wi≤m}</strong></p><p>in this we check if <strong>(m&gt;0)</strong> which means if the knapsack is still having the capacity to hold objects &amp; the chosen object<strong> (wi)</strong> can completely be placed in the knapsack <strong>(wi≤m)</strong>.</p><p>Then step 5 is decrease the capacity of the knapsack with the weight of object i.e <strong>m =m-wi, and</strong> then increase the total profit by adding profit of weight <strong>P=P+pi. </strong>if the previous condition is not true step9 is <strong>break</strong>. and we will check knapsack is still have space and we couldn’t able to put object completely the step10 is we could place the fraction of the profit. So if we go according to the algorithm then first object to add will be like shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*dvUT5V8hfIyaTIv3z8MzuA.png" /><figcaption>image 8</figcaption></figure><p>as shown in image 7, object5 contains max val of profit and weight ratio(p/w) which is 6.</p><p>Step1- Add object 5 in the stack as shown in above image and remove its weight from the total weight of knapsack m=15–1=14. and increse the profi, so P=0+6=6</p><p>Step2 — Add object 1 into stack, whose p/w=5, then m= 14-2=12. now toatal profit will be p=6+10=16</p><p>Step3 : similary add other objects as shown in the above image till knapsack size become zero i.r m=0.</p><p>Step4: When m=0 our profit will be like P=6+10+18+15+3+5*(2/3) = 55.3 (total profit).</p><p>Now lets see the time complexity of the algorithm.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3403a1eddf2461b6f5eb97c24353dcf3/href">https://medium.com/media/3403a1eddf2461b6f5eb97c24353dcf3/href</a></iframe><p>from above evaluation we found out that <strong>time complexity is O(nlogn)</strong>.</p><p>**Note: Greedy Technique is only feasible in fractional knapSack. where we can divide the entity into fraction . But for 0/1 knapsack we have to go Dynamic Programming. As in 0/1 knapsack we could either take the item or not take the item</p><p>Applications of Knapsack :-</p><ul><li>Cognitive Radio Networks</li><li>Resource management in software</li><li>Plastic Bags Waste Management Using the Knapsack Model</li></ul><h3>Resources</h3><p>If you want to explore more about fractional knapsack and also from where i have learnt about this technique?. I have listed down some references.</p><ul><li><a href="https://en.wikipedia.org/wiki/Knapsack_problem">wikipedia link</a></li><li><a href="https://www.geeksforgeeks.org/fractional-knapsack-problem/">GeekForGeeks link</a></li><li><a href="https://www.researchgate.net/publication/322951612_Some_applications_of_Knapsack_problem">Applications of knapsack</a></li></ul><p>This algorithm is one of the many algorithms that download managers use apart from compressing, encrypting etc etc.</p><p><em>If you like the my hard work and effort, you can do one clap, two clap or may be fourty…</em></p><p>You can also Follow me and <a href="https://medium.com/walkinthecode">WalkIntheCode </a>for more articles like this</p><p>You can also find me on..</p><p><a href="https://www.linkedin.com/in/aryan-dhankar-961b50117/?originalSubdomain=in">LinkedIn</a> , <a href="https://twitter.com/elite_novice">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aba1daecc93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/walkinthecode/greedy-algorithm-fractional-knapsack-problem-9aba1daecc93">Greedy algorithm ( Fractional Knapsack problem )</a> was originally published in <a href="https://medium.com/walkinthecode">WalkInTheCode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimization Problem]]></title>
            <link>https://medium.com/mindorks/optimization-problem-982205f906fe?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/982205f906fe</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Wed, 15 May 2019 05:11:54 GMT</pubDate>
            <atom:updated>2019-05-15T05:38:59.411Z</atom:updated>
            <content:encoded><![CDATA[<h3>Optimization Problems</h3><p>I think you guys are aware of what really an Optimization Problem. But if you are not, then I will explain to you what really these Optimization problem is, and what could be the possible solutions for that.</p><p><strong>Optimization Problem</strong>:- It is a problem of finding the best possible solution from all the feasible solutions.</p><p>Now we will understand this with the help of an example. Let’s say there is a weighted graph</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*nSH9LDAQK7_xAdbfBoag5Q.png" /><figcaption>GraphA</figcaption></figure><p>on the left side. In this A, B..E are the nodes and AC is an Edge whose weight is 5. Similarly, the graph consists of other edges with corresponding weights. So what if we have to find the shortest path from node A to node E.</p><p>Question:- What is the shortest path from node A to E ?.</p><p><strong>Answer</strong>:- The simplest way to solve this is <strong>Exhaustive Approach</strong>. Here exhaustive approach means first to find out all the possible path from node A to node E, and then among all those possible outcomes, find the one path with the least value.</p><p>So if there are n edges, then in a path an edge might be present or might not be present, in that case for every edge we have two chances. Therefore we have to examine total 2^n <strong>paths</strong>. So by this kind of approach, we might end up with <strong>exponential time </strong>i.e O(2^n).</p><p>Now we have to see if we could find something better than O(2^n).To solve these kinds of Optimization problems, there are two programming paradigms…</p><ol><li><strong>Greedy Method Approach</strong></li><li><strong>Dynamic Programming</strong></li></ol><p><strong>Greedy Approach</strong>:- With the greedy approach we can solve optimization problems but not all of them. A greedy algorithm, as the name suggests, always makes the choice that seems to be the best at that moment. This means that it makes a locally-optimal choice in the hope that this choice will lead to a globally-optimal solution.</p><p><strong>Dynamic Programming(DP)</strong>:- With the help of DP we will be able to solve any optimization problem, but some problem even after applying dynamic programming might go to exponential time. So with dynamic programming, we could get O(n^k) solutions.</p><p>So instead of talking about the theory, and what are the characteristics that a problem should contain, I would pick up some problems and we shall see how these methods would be applied. So after seeing examples, above theory will be very much clear to you. So in the next post, we will talk about Greedy method.</p><p><em>If you like the my hard work and effort, you can do one clap, two clap or may be fourty…</em></p><p>You can also find me on..</p><p><a href="https://www.facebook.com/aryan.dhankar.3">Facebook</a>, <a href="https://twitter.com/elite_novice">Twitter</a>, <a href="https://github.com/GitEliteNovice">GitHub</a>, <a href="https://in.linkedin.com/in/aryan-dhankar-961b50117">LinkedIn</a>, <a href="https://www.quora.com/profile/Aryan-Dhankar">Quora</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=982205f906fe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mindorks/optimization-problem-982205f906fe">Optimization Problem</a> was originally published in <a href="https://medium.com/mindorks">MindOrks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best way to tackle any problem in development.]]></title>
            <link>https://medium.com/mindorks/best-way-to-tackle-any-problem-in-development-f13f85263d34?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/f13f85263d34</guid>
            <category><![CDATA[advice]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Fri, 13 Apr 2018 20:02:58 GMT</pubDate>
            <atom:updated>2018-04-14T06:41:07.498Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*67tOoaCjtDJzCE-s5-yaxw.gif" /><figcaption>Source: Google</figcaption></figure><h3><strong>1. Understand the problem:</strong></h3><p>Don’t just start writing code in the first place, first try to understand the problem. The cause of the problem should be clear in your mind. If possible try to divide the problem into small parts and then try to find what we have and what we want. And then try to find the best solution for that problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*_VZN37-s_lOk2rKbdQJl9Q.gif" /><figcaption>Robustness</figcaption></figure><h3>2. Try to find the Robustness of your solution:</h3><p>Don’t just implement as soon as you find it. First try to understand up to what level the solution can sustain. Up to what extent Solution will work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*Qw89xYRXGsS0yyORaDL-ZA.gif" /><figcaption>Source: Google</figcaption></figure><h3>3. Discus your solution:</h3><p>Even if you got the solution to the problem, first discuss your solution with your team. Maybe someone in your team encountered the same problem in his past and have the better working solution to the problem. Or they can also do some amendment in that solution if required.</p><p>I had heard these from <a href="https://medium.com/u/65fb31e804c4">Amrit Sanjeev</a> in #gddIndia : <strong>Don’t try to throw your problem on others. No one has time to solve your problems. But if you ask for advice, you will definitely get some.</strong></p><p>#Quote : Best way to get rid of the problem, is to face it.</p><p><em>If you like it ,please share…</em></p><p>You can also find me on..</p><p><a href="https://github.com/GitEliteNovice">GitHub</a> , <a href="https://www.facebook.com/aryan.dhankar.3">Facebook</a>, <a href="https://www.quora.com/profile/Aryan-Dhankar">Quora</a> , <a href="https://twitter.com/elite_novice">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f13f85263d34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mindorks/best-way-to-tackle-any-problem-in-development-f13f85263d34">Best way to tackle any problem in development.</a> was originally published in <a href="https://medium.com/mindorks">MindOrks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What really the ThreadPool Is…]]></title>
            <link>https://medium.com/mindorks/what-really-the-threadpool-is-59a2dcd36e80?source=rss-a53917d9c346------2</link>
            <guid isPermaLink="false">https://medium.com/p/59a2dcd36e80</guid>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[thread-pool]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Aryan Dhankar]]></dc:creator>
            <pubDate>Sun, 14 Jan 2018 13:04:18 GMT</pubDate>
            <atom:updated>2018-01-14T15:41:14.489Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCaUiTlpcBTAg4hcmjJx4A.jpeg" /><figcaption>A pool</figcaption></figure><p><strong>Threadpool</strong>:- As its name resembles a pool of threads. It contains some threads, which it reuses, again and again, to accept task submitted to it and run it in one of the thread.</p><p>So what is describe the requirement of a thread pool, I have mentioned a conversation between two guys…</p><p><strong>Harold </strong>:<em> Hey Kumar, my app starts lagging and sometimes show ANR dialog…</em></p><p><strong>Kumar</strong>: <em>There could be the problem of Memory leak in your Application…</em></p><p><strong>Harold</strong>: <em>Not, I haven’t found any memory leak in my app, I am also doing all my work in the background…</em></p><p><strong>Kumar</strong>: <em>So what are you using, to perform your task in Background.</em></p><p><strong>Harold</strong>: <em>I am creating a separate Thread whenever there is any need to perform the task in the background.</em></p><p><strong>Kumar</strong>: <em>There you are… Bro creating new Thread again and again may lead to Thread overhead.</em></p><p><strong>Harold</strong>: <em>So we aren’t allowed to create separate Thread to do some work.</em></p><p><strong>Kumar</strong> : <em>Bro I am not saying that , what I mean is that if we create new thread it takes space in memory(CPU allow our some heap to program and some space from that heap is allocated to us ) and our app has very limited amount to space allocated to CPU, and when thread is no longer used GC will be called to free up the space . So more thread you create more fast Garbage collection occur. And Gc isn’t in control of programmer, If garbage collection occurs in the middle of an intensive processing loop like an animation or during music playback, it can increase processing time, the main thread cannot finish executing blocks of work within 16ms, the user may observe hitching, lagging, or a lack of UI responsiveness to input.</em></p><p><strong>Harold</strong>:<em> Okk…So is there any way to do my work in separate thread…</em></p><p><strong>Kumar</strong>:<em> Yes, You Can Go to Thread Pool. Thread pool creates only a few number of threads, and then reuse them again and again to complete the tasks submitted by the user.</em></p><p><strong>Harold <em>:</em></strong><em> So how many of thread will it create and how can we put our work in its threads….and what are its advantages…</em></p><p><strong>Kumar</strong>:</p><p><em>1. Thread pool allows us to create a number of threads we want to create. And Then it uses these threads to do our background tasks.</em></p><p><em>2. Thread pool also manages synchronization of threads by its own.</em></p><p><em>3. We can do work in parallel in two separate threads.</em></p><p><em>4. We can also do prioritization among Threads.</em></p><p><em>5. Even for a small task, you can use a thread pool, because it will not create a new thread, it will perform the work in the existing threads.</em></p><p><em>we can use Threadpool, for every single task.You just have to initialize the singleton class of thread pool and when you want to do some task in a separate thread just pass your runnable in the thread pool, it will execute it in one of its threads, and you can get the data or notify when work complete in UI using Handler..</em></p><p><em>Now we will see how to implement it…</em></p><p><em>Threadpool Executor is a class which allows us to use thread pool easily. There are 4 constructors in this class but here I will explain only one of it…</em></p><p><strong>public </strong>ThreadPoolExecutor(<strong>int </strong>corePoolSize, <strong>int </strong>maximumPoolSize, <strong>long </strong><a href="https://www.blogger.com/null">keepAliveTime</a>, TimeUnit unit, BlockingQueue&lt;java.lang.Runnable&gt; workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler);</p><p><em>Now let me explain you each signature one by one:-</em></p><p><strong>Core pool size</strong>:-<em>the number of threads that we need to have in thread pool in the first place. Initially, there are no threads in the thread pool.</em></p><p><strong>MaximumPoolSize</strong>:-<em> the maximum number of threads that we want to have in our pool.</em></p><p><strong>WorkQueue</strong>:- <em>it this the queue that will hold the runnable, which will be submitted to the thread pool and when any of the thread pool thread ask for the task, this queue will provide that task to the thread. This is of BlockingQueue type</em>.</p><p><strong>KeepAliveTime</strong>:- <em>it is time up to which free threads will wait to get a new task if the thread wouldn’t get the task within KeepAliveTime, the thread will terminate.</em></p><p><strong>Unit</strong>:- <em>unit of time for KeepAliveTime.</em></p><p><strong>ThreadFactory</strong>:- <em>it helps thread pool to create a new Thread on demand.we Can also customize it but we will see it later.</em></p><p><strong>RejectedExecutionHandler</strong>:-<em> it is the handler to handle the exception RejectedExecutionException.</em></p><p><strong>RejectedExecutionException</strong>:- <em>this is the exception that workQueue will throw when the queue is full and still we try to insert runnable in it.</em></p><p><em>Here is how we can create our own RejetedExecutionHandler implementation to handle jobs that can’t fit in worker queue</em>: —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5c4da0b05886a74df19bb2d57a8043b/href">https://medium.com/media/b5c4da0b05886a74df19bb2d57a8043b/href</a></iframe><p><em>Now here is the implementation of Threadpool executor:-</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce8c51e15e2a8830265471e9491b7b06/href">https://medium.com/media/ce8c51e15e2a8830265471e9491b7b06/href</a></iframe><p><em>My runnable class that has to pass in the executor</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/468a13653298c5df48c6a6ff2be99a2c/href">https://medium.com/media/468a13653298c5df48c6a6ff2be99a2c/href</a></iframe><p><em>You can find the Sample Code of Threadpool from here:-</em></p><p><a href="https://github.com/GitEliteNovice/PoolOfThreads">GitEliteNovice/pool of threads</a></p><p><em>If you want to know more about Threadpool you can refer here…</em></p><p><a href="https://blog.mindorks.com/threadpoolexecutor-in-android-8e9d22330ee3">Threadpoolexecutor By Mindorks</a></p><p><em>I have learned lots of things from Mindorks, they are really fabulous…</em></p><p><em>If you like the my hard work and effort, you can do one clap, two clap or may be fourty…</em></p><p>You can also find me on..</p><p><a href="https://github.com/GitEliteNovice">GitHub</a> , <a href="https://www.facebook.com/aryan.dhankar.3">Facebook</a>, <a href="https://www.quora.com/profile/Aryan-Dhankar">Quora</a> , <a href="https://twitter.com/elite_novice">Twitter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59a2dcd36e80" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mindorks/what-really-the-threadpool-is-59a2dcd36e80">What really the ThreadPool Is…</a> was originally published in <a href="https://medium.com/mindorks">MindOrks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>