<?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 Shashank Pednekar on Medium]]></title>
        <description><![CDATA[Stories by Shashank Pednekar on Medium]]></description>
        <link>https://medium.com/@pednekarshashank33?source=rss-3766338e2857------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1taTmJQ0Xm9QLukdhaUlYQ.jpeg</url>
            <title>Stories by Shashank Pednekar on Medium</title>
            <link>https://medium.com/@pednekarshashank33?source=rss-3766338e2857------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:21:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pednekarshashank33/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[The Biggest Message from Google I/O and KotlinConf Wasn’t Just About AI]]></title>
            <link>https://proandroiddev.com/the-biggest-message-from-google-i-o-and-kotlinconf-wasnt-just-about-ai-b5d741f7e747?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5d741f7e747</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 02:28:41 GMT</pubDate>
            <atom:updated>2026-07-03T10:12:37.589Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong><em>Notes and reflections from three discussions at Google I/O 2026 and KotlinConf 2026 on AI, software engineering, and the future of developer work.</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RdKsS65zM1P37GtrlfgbrQ.png" /></figure><p>Over the last few weeks, I watched three discussion-heavy sessions from Google I/O 2026 and KotlinConf 2026.</p><p>Unlike the usual conference talks that focus on new frameworks, language features, or product announcements, these sessions discussed something much more important:</p><p><strong>How AI is changing the craft of software engineering itself.</strong></p><p>The speakers came from different backgrounds and organizations, yet they all seemed to arrive at the same conclusion:</p><blockquote><em>The future of software engineering is not about writing more code. It’s about understanding systems, making better decisions, and working effectively with AI.</em></blockquote><p>As I went through these sessions, several common themes kept appearing. Here are the ideas that stood out the most.</p><h3>Writing Code Was Never the Hard Part</h3><p>One of the strongest messages across all three talks was surprisingly simple:</p><blockquote><em>Writing code was never the hard part.</em></blockquote><p>For years, many of us associated software engineering with our ability to write code quickly, memorize syntax, or master frameworks. But engineering has always been much more than programming.</p><p>A definition shared during one of the sessions described engineering as:</p><blockquote><em>“Programming integrated over time.”</em></blockquote><p>Anyone can build a prototype. AI can now generate one in seconds.</p><p>The real challenge begins when software needs to survive changing business requirements, scale, security reviews, production incidents, maintenance, and years of evolution.</p><p>This is where engineering starts.</p><p>The discussions repeatedly emphasized that critical thinking, system design, and trade-off analysis are becoming more valuable than the act of typing code.</p><p>Security versus performance.</p><p>Flexibility versus simplicity.</p><p>Speed versus maintainability.</p><p>These are decisions AI cannot fully make because they depend on business context and human judgment.</p><p>Jake Wharton reinforced a related idea:</p><blockquote><em>Code is read far more than it is written.</em></blockquote><p>The challenge is not producing code. The challenge is ensuring future engineers can understand and safely modify it as requirements evolve.</p><h3>Senior Engineers Are Being Redefined</h3><p>Historically, seniority often meant being able to write code that others couldn’t.</p><p>Today, that definition is changing.</p><p>One of the speakers described modern seniority as:</p><blockquote><em>The ability to understand code others can’t.</em></blockquote><p>That “<strong>others</strong>” now includes AI.</p><p>As AI becomes capable of generating increasingly large portions of code, the value of an engineer shifts from code production to code comprehension.</p><p>Senior engineers are becoming responsible for:</p><ul><li>Breaking problems into smaller components</li><li>Performing trade-off analysis</li><li>Validating AI-generated solutions</li><li>Understanding complex systems</li><li>Maintaining architectural consistency</li></ul><p>The future senior engineer may spend less time writing code and more time ensuring the right code is being written.</p><h3>AI Raised the Floor, Not the Ceiling</h3><p>The rise of AI has dramatically lowered the barrier to building software.</p><p>People are already creating prototypes through what many now call “vibe coding” — describing what they want and allowing AI to generate an implementation.</p><p>This is a remarkable shift.</p><p>Non-developers can now build functional applications that would have required engineering teams only a few years ago.</p><p>But the speakers repeatedly highlighted an important distinction:</p><blockquote><em>There is a massive gap between one-shotting a solution and battle-hardening it for production.</em></blockquote><p>Generating a working feature is easier than ever.</p><p>Building secure, reliable, maintainable, observable software remains difficult.</p><p>AI has raised the floor.</p><p>It has not removed the ceiling.</p><h3>The Risk Nobody Talks About: Cognitive Debt</h3><p>One of the most interesting concepts discussed was something called <strong>cognitive debt</strong>.</p><p>Technical debt accumulates inside code.</p><p>Cognitive debt accumulates inside engineers.</p><p>When developers increasingly rely on AI to solve problems, generate implementations, and make decisions, they risk losing their own understanding of how systems work.</p><p>Over time, problem-solving abilities can erode because the thinking is being outsourced.</p><p>An even bigger risk is what the speakers called <strong>cognitive surrender</strong>.</p><p>This happens when developers blindly accept AI output without questioning it.</p><p>Without validation, critical thinking, or understanding, teams can slowly create what was described as a “house of cards” codebase — one that appears functional but lacks deep understanding from the people maintaining it.</p><p>The lesson wasn’t to avoid AI.</p><p>The lesson was to remain intellectually engaged.</p><p>One practical recommendation was adopting a habit of treating AI as an adversarial mentor.</p><p>After completing a task, ask:</p><blockquote><em>“What did I miss? What isn’t right? Don’t be nice.”</em></blockquote><p>Instead of treating AI as an unquestionable authority, use it as a critic that challenges your assumptions.</p><h3>From Programming to Intent-Driven Engineering</h3><p>Another recurring theme was that developers are moving away from being programmers and becoming intent-driven engineers.</p><p>Rather than focusing on language syntax, IDE shortcuts, or framework-specific details, engineers increasingly describe desired outcomes and architectural constraints.</p><p>The implementation details can then be delegated to AI.</p><p>Several experts even suggested “de-skilling” on syntax.</p><p>Not because programming languages no longer matter, but because memorizing every detail of every language is becoming less valuable.</p><p>Many experienced engineers now regularly work across multiple languages each week, using AI to bridge syntax gaps while focusing on the problem itself.</p><p>The emphasis is shifting from:</p><p>“How do I write this?”</p><p>to</p><p>“What exactly should be built?”</p><p>That is a fundamentally different skill.</p><h3>The Rise of Agentic Engineering</h3><p>One of the most fascinating ideas discussed was the emergence of agentic engineering.</p><p>Developers are increasingly working with multiple AI agents running tasks in parallel.</p><p>These agents can investigate bugs, generate tests, explore solutions, create documentation, and handle isolated engineering workstreams.</p><p>One speaker compared this experience to:</p><blockquote><em>Doubling your team size with junior engineers.</em></blockquote><p>But this introduces a new challenge.</p><p>Just as human engineers require context, AI agents require context too.</p><p>The sessions repeatedly highlighted the growing importance of high-quality documentation, architectural records, and clear design decisions.</p><p>The better your documentation, the more effective both humans and AI become.</p><h3>Software Engineering Is Approaching a Tipping Point</h3><p>The most thought-provoking session introduced the concept of <strong>Software Ecology</strong>.</p><p>Software Ecology is the study of the entire socio-technical system that produces software — the combination of people, tools, processes, architecture, culture, and technology.</p><p>The argument was simple:</p><p>AI will allow us to generate dramatically more code.</p><p>Potentially 10x.</p><p>Potentially 100x.</p><p>But the systems surrounding software development were never designed for that scale.</p><p>More code means:</p><ul><li>More reviews</li><li>More testing</li><li>More builds</li><li>More dependencies</li><li>More architectural complexity</li></ul><p>As codebases grow, some challenges grow disproportionately.</p><p>Testing can become exponentially more expensive.</p><p>Compile times become longer.</p><p>Version control systems experience greater pressure.</p><p>Review processes become bottlenecks.</p><p>The problem is no longer generating code.</p><p>The problem is understanding and validating it.</p><p>This is where the concept of “shared fate” becomes important.</p><p>In large software ecosystems, every component affects every other component.</p><p>A small change in one area can ripple across thousands or millions of lines of code.</p><p>As AI accelerates software creation, understanding these interconnected systems becomes increasingly important.</p><h3>AI Is an Amplifier, Not a Miracle</h3><p>Perhaps the most important takeaway from all three sessions was this:</p><blockquote><em>AI is a magnitude, not a direction.</em></blockquote><p>AI amplifies whatever already exists within an engineering organization.</p><p>If a team has:</p><ul><li>Strong architecture</li><li>Good documentation</li><li>Healthy engineering culture</li><li>Effective testing practices</li></ul><p>AI amplifies those strengths.</p><p>If a team has:</p><ul><li>Poor documentation</li><li>Weak engineering fundamentals</li><li>Fragile architecture</li><li>Unclear ownership</li></ul><p>AI amplifies those weaknesses too.</p><p>The technology itself does not automatically improve engineering.</p><p>It accelerates whatever system it is introduced into.</p><h3>Looking Ahead</h3><p>My biggest takeaway from these sessions is that software engineering is not disappearing — it is evolving.</p><p>The industry often focuses on how quickly AI can generate code, but the more interesting question is what remains uniquely human.</p><p>The answer seems remarkably consistent across Google I/O and KotlinConf:</p><ul><li>Understanding business problems</li><li>Framing the right questions</li><li>Making trade-offs</li><li>Designing architectures</li><li>Maintaining long-term systems</li><li>Exercising critical thinking</li></ul><p>As codebases continue growing beyond what any individual can fully memorize, AI will likely become essential not only for generating code but also for helping us reason about increasingly complex systems.</p><p>The future engineer may write less code than previous generations.</p><p>But their responsibility will be greater than ever.</p><p>Because the real challenge was never writing code.</p><p>It was understanding the system behind it.</p><p>If this article was helpful, consider following me on <a href="https://www.linkedin.com/in/shashank-s-pednekar/"><strong>LinkedIn</strong></a> and <a href="https://x.com/ShashankP27"><strong>X</strong> </a>— I regularly share insights on Android, Kotlin, AI, and software engineering.</p><h4><strong>References</strong></h4><p>The article is based on insights from the following sessions:</p><p><a href="https://www.youtube.com/watch?v=VTYx7Ex-0bA">1. A Fireside Chat on the Evolution of the Developer Craft (Google I/O 2026)</a></p><p><a href="https://www.youtube.com/watch?v=IpdOheudcZ4">2. Jake Wharton | KotlinConfersations ’26 (KotlinConf 2026)</a></p><p><a href="https://www.youtube.com/watch?v=2n41YjR5QfU">3. Software Engineering at the Tipping Point (Google I/O 2026)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5d741f7e747" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/the-biggest-message-from-google-i-o-and-kotlinconf-wasnt-just-about-ai-b5d741f7e747">The Biggest Message from Google I/O and KotlinConf Wasn’t Just About AI</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Personal Finance Is Not Optional — It’s Survival]]></title>
            <link>https://pednekarshashank33.medium.com/personal-finance-is-not-optional-its-survival-ceeeaa9cdea3?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceeeaa9cdea3</guid>
            <category><![CDATA[personal-finance]]></category>
            <category><![CDATA[mutual-funds]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[financial-planning]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 02:33:36 GMT</pubDate>
            <atom:updated>2026-02-24T02:33:36.095Z</atom:updated>
            <content:encoded><![CDATA[<h3>Personal Finance Is Not Optional — It’s Survival</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UFCcysNLqzakQK60O8oGHg.png" /><figcaption>Image build using Gemini</figcaption></figure><p><strong>“पैशाचं सोंग घेता येत नाही.”</strong></p><p>There is a Marathi proverb that says — <em>you cannot pretend to have money.</em><br>You cannot fake wealth when a medical emergency comes.<br>You cannot pretend financial stability when salary gets delayed.<br>You cannot act rich when real problems require real money.</p><p>No matter what your profession is — engineer, doctor, teacher, freelancer, entrepreneur — <strong>personal finance is something everyone must understand.</strong></p><p>Because at the end of the day:</p><blockquote><strong><em>Money makes money. But only if managed properly.</em></strong></blockquote><h3>Current Market Observations (Some Questions We Should Ask Ourselves)</h3><p>Even after recent corrections and phases of low or no returns, many discussions are going on that the Indian market looks overvalued.</p><p>Why are people saying that?</p><h3>1️⃣ Is There Something Like a SIP Bubble?</h3><p>Stock prices are decided by demand and supply.</p><p>In India today, we have:</p><ul><li>Regular SIP flows every month</li><li>Some portion of EPFO money going into equities</li><li>NPS exposure to markets</li><li>Campaigns like “Mutual Funds Sahi Hai” working effectively</li><li>Increasing financial awareness through finfluencers</li></ul><p>There is nothing wrong in this. In fact, awareness is good.</p><p>But a question remains:</p><blockquote><em>If continuous systematic inflows keep coming, does it create artificial demand stability?</em></blockquote><p>Something worth thinking about.</p><h3>2️⃣ FIIs Are Net Sellers — Why?</h3><p>For the last few years, FIIs (Foreign Institutional Investors) have largely been net sellers.</p><p>Most FIIs:</p><ul><li>Do deep research</li><li>Invest long-term</li><li>Allocate capital strategically across countries</li></ul><p>So, the question becomes:</p><blockquote><em>Why are they reducing exposure while domestic inflows remain strong?</em></blockquote><h3>3️⃣ IPOs — Growth Story or Exit Route?</h3><p>There are many IPOs happening.</p><p>But:</p><ul><li>Many IPOs are offer-for-sale (OFS)</li><li>Early investors are exiting</li><li>Fresh capital infusion is sometimes limited</li><li>Valuations often look aggressive</li></ul><p>So we should ask:</p><blockquote><em>Are IPOs always growth opportunities?<br>Or sometimes liquidity events for early investors?</em></blockquote><p>Not all IPOs are bad. But not all are great either.</p><h3>The Real Question: What Should a Common Investor Do?</h3><p>Most of us are not stock market experts.</p><p>We have jobs.<br>We have responsibilities.<br>We have family.<br>We have EMIs.</p><p>So what is the solution?</p><p>The answer is simple — <strong>never skip risk management.</strong></p><h3>Step 1: Risk Management Before Return Management</h3><h3>✅ 1. Emergency Fund</h3><p>Minimum:</p><ul><li>6 months of salary or expenses<br>Ideal:</li><li>12–18 months (depending on income stability)</li></ul><p>This money is not for investing.<br>This is for survival.</p><p>Personally, I follow one strict rule:</p><blockquote><em>I don’t touch emergency money unless there is salary delay, job loss, or medical emergency.</em></blockquote><p>Emergency fund gives:</p><ul><li>Financial cushion</li><li>Mental peace</li><li>Decision-making freedom</li></ul><p>Returns are secondary here. Stability is primary.</p><h3>✅ 2. Health Insurance</h3><p>Not just for you — for your family.</p><p>Medical inflation is real.<br>Corporate insurance is not always sufficient.<br>Job loss can remove that coverage.</p><p>Health insurance is not an investment.<br>It’s protection.</p><h3>✅ 3. Pure Term Insurance</h3><p>Keep it simple.</p><p>Go for plain term insurance.</p><p>No mixing of insurance + investment products.</p><p>Insurance is for protection.<br>Investment is for wealth creation.<br>Don’t mix both.</p><h3>Divide Money by Time Horizon</h3><p>One of the biggest mistakes people make:</p><blockquote><em>Investing short-term money into volatile assets.</em></blockquote><p>Short-term goals (1–3 years):</p><ul><li>Don’t put in equity</li><li>Don’t put in gold</li><li>Don’t put in silver</li></ul><p>These are volatile.</p><p>Short-term money should stay in:</p><ul><li>Fixed deposits</li><li>Debt instruments</li><li>Treasury bills</li><li>Low-duration debt funds</li></ul><p>Will they beat inflation easily? Maybe not.</p><p>But they protect capital.</p><p>And capital protection matters for short-term goals.</p><h3>Building a Sensible Portfolio</h3><p>Once risk management is done, then think about growth.</p><h3>🔹 Diversify, But Don’t Over-Diversify</h3><p>Choose:</p><ul><li>2–3 good equity mutual funds</li><li>Some allocation to gold ETFs</li><li>Some exposure to international funds</li><li>Some allocation to high quality debt funds</li></ul><p>But don’t go fund shopping.</p><p>Remember:<br>One equity mutual fund may already hold atleast 20–40 stocks.</p><p>If you buy 10 funds, you may end up owning everything — without clarity.</p><h3>🔹 Define Asset Allocation</h3><p>Decide:</p><ul><li>How much equity?</li><li>How much debt?</li><li>How much gold?</li><li>How much international exposure?</li></ul><p>Then:<br>Rebalance once or twice a year.</p><p>Not every week.<br>Not every market correction.</p><h3>🔹 In Debt Funds — Don’t Chase Yield</h3><p>Simple thumb rule:</p><blockquote><em>Lower maturity → Lower risk</em></blockquote><p>Don’t run behind:</p><ul><li>High yield</li><li>Low-rated bonds</li><li>Slightly higher return traps</li></ul><p>In debt, protecting principal is more important than chasing extra 1–2%.</p><h3>Review, But Don’t Obsess</h3><p>Review:</p><ul><li>Mutual funds</li><li>Stocks</li><li>ETFs</li><li>Bonds</li></ul><p>Once or twice a year.</p><p>Stocks need more attention.<br>But that’s a different discussion.</p><h3>The Most Important Part: Behaviour Management</h3><p>Market cycles will come.<br>Corrections will come.<br>Bull markets will come.<br>Bear markets will test patience.</p><p>The biggest risk is not volatility.</p><p>The biggest risk is behaviour.</p><p>Set a process.<br>Create discipline.<br>Follow asset allocation.<br>Avoid emotional decisions.</p><h3>Keep Learning</h3><p>In your free time:</p><ul><li>Read about personal finance</li><li>Study investor psychology</li><li>Understand valuation</li></ul><p>Books like:</p><ul><li><em>The Psychology of Money</em> by Morgan Housel</li></ul><p>Reading platforms like:</p><ul><li>Value Research Online</li></ul><p>Understanding valuation thinkers like:</p><ul><li>Aswath Damodaran</li></ul><p>Learning never stops.</p><h3>Final Thought</h3><p>You don’t need to be a market expert.</p><p>You just need:</p><ul><li>Basic risk management</li><li>Asset allocation</li><li>Discipline</li><li>Behaviour control</li></ul><p>Because at the end of the day:</p><p><strong>“पैशाचं सोंग घेता येत नाही.”</strong></p><p>When real life hits — <br>only real money solves real problems.</p><p>Follow me on:</p><p><a href="https://www.linkedin.com/in/shashank-s-pednekar/">Shashank Pednekar | LinkedIn</a></p><p><a href="https://x.com/shashankp27">https://x.com/shashankp27</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceeeaa9cdea3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does AI tools making us lazy? Or this is changing the way how you code.]]></title>
            <link>https://pednekarshashank33.medium.com/does-ai-tools-making-us-lazy-or-this-is-changing-the-way-how-you-code-9aee024c4de5?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aee024c4de5</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 02:43:42 GMT</pubDate>
            <atom:updated>2026-02-03T02:43:42.435Z</atom:updated>
            <content:encoded><![CDATA[<p>Every few years, a new tool shows up and triggers the same fear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*HzJnDPurkIJblFerkuuTeA.png" /><figcaption>Build using Gemini</figcaption></figure><blockquote><em>“Is this making developers lazy?”</em></blockquote><p>AI coding tools are just the latest entry in that long list.<br>But maybe we’re asking the wrong question.</p><p>Instead of <em>“Does AI make us lazy?”</em><br>The real question is: <strong>How does AI change the way we code?</strong></p><h3>What AI Gets Right (When Used Correctly)</h3><p>Let’s start with the good part — because there <em>is</em> a lot of it.</p><p>AI tools are excellent at:</p><ul><li>Generating boilerplate code</li><li>Handling repetitive or mechanical tasks</li><li>Speeding up initial drafts and scaffolding</li></ul><p><strong>This matters.</strong></p><p>By offloading the tedious parts, AI frees developers to focus on:</p><ul><li>System design</li><li>Edge cases</li><li>Performance</li><li>Product thinking</li><li>Real-world constraints</li></ul><p>That’s not laziness. That’s <strong>leverage</strong>.✨</p><p>Used well, AI doesn’t replace thinking — it <strong>creates space for better thinking</strong>.</p><h3>Where Things Can Go Wrong</h3><p>AI becomes dangerous only when we stop being engineers.</p><p>A few non-negotiables:</p><ul><li><strong>Always test before applying changes</strong></li><li><strong>Never skip code review (especially for AI-generated code)</strong></li></ul><p>For complex problems, blindly trusting AI is a mistake.<br>Your own research, experience, and context often lead to <strong>better and safer solutions</strong> than a generic output.</p><p>AI doesn’t understand:</p><ul><li>Your business constraints</li><li>Your legacy trade-offs</li><li>Your production risks</li></ul><p><strong>You do.</strong></p><h3>Think of AI as a “Genius Intern”</h3><p>Here’s the mindset shift that works best for me:</p><blockquote><em>Treat AI like a very fast, very smart intern.</em></blockquote><p>It can:</p><ul><li>Draft code quickly</li><li>Suggest multiple approaches</li><li>Help you unblock yourself</li></ul><p>But <strong>you are responsible for reviewing its work</strong>.</p><p>This is beautifully reflected in the name <strong>GitHub Copilot</strong>:</p><ul><li>You’re the <strong>pilot ✈️</strong></li><li>AI is the <strong>co-pilot</strong></li></ul><p>A co-pilot assists.<br>It does <strong>not</strong> fly the plane alone.</p><h3>Your Name Is Still on the Commit🏷️</h3><p>At the end of the day:</p><ul><li>You are responsible for the code</li><li>Your name is on that commit</li><li>You own the bugs, crashes, and vulnerabilities</li></ul><p>If AI is used without critical thinking, it can slowly erode:</p><ul><li>Problem-solving skills</li><li>Debugging intuition</li><li>Architectural judgment</li></ul><p>And those skills are what make a <em>good</em> engineer.</p><h3>This Isn’t the First Big Shift in Coding</h3><p>In the 90s, people literally stored programs on punched cards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ilw6P_BRplg-NVlLgG_zRQ.jpeg" /><figcaption>A 12-row/80-column <a href="https://en.wikipedia.org/wiki/IBM">IBM</a> punched card from the mid-twentieth century</figcaption></figure><p>That didn’t “rot” developers’ brains.<br>It was simply <strong>the tool of that era</strong>.</p><p>AI is no different.</p><p>Instead of replacing thinking, it can reduce cognitive load — allowing us to focus more on:</p><ul><li>Strategic decisions</li><li>Communication</li><li>Understanding user problems</li><li>Building the <em>right</em> solution, not just <em>any</em> solution</li></ul><h3>So… Are We Getting Lazy?</h3><p>You’re not paid to write code.</p><p>You’re paid to <strong>solve problems</strong>.</p><p>So the real takeaway is this:</p><blockquote><em>The core question isn’t </em>“Does AI make us lazy?”<em><br> It’s </em>“How do we code with AI?”</blockquote><p>Used thoughtfully, AI is a powerful accelerator that improves both <strong>speed and quality</strong>.<br>Used blindly, it can lead to fragile systems, hidden bugs, and security risks.</p><p>In the end, it’s your choice:</p><ul><li>Build high-quality software with a powerful assistant</li><li>Or ship rushed code by copy-pasting without thinking</li></ul><p>The tool is neutral.<br><strong>The responsibility is still yours.</strong></p><p><strong>Happy Coding &lt;&gt; Vibe Coding 😉</strong></p><p>Follow me on:</p><p>https://www.linkedin.com/in/shashank-s-pednekar</p><p><a href="https://x.com/ShashankP27">JavaScript is not available.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aee024c4de5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Memorizing ‘in' and ‘out': Use This Simple Mental Model for Kotlin Variance]]></title>
            <link>https://proandroiddev.com/stop-memorizing-in-and-out-use-this-simple-mental-model-for-kotlin-variance-4ec10d5fec20?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ec10d5fec20</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[generics]]></category>
            <category><![CDATA[android-interviews]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Tue, 09 Dec 2025 03:51:07 GMT</pubDate>
            <atom:updated>2026-03-01T06:25:19.850Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stop Memorizing ‘in&#39; and ‘out’: Use This Simple Mental Model for Kotlin Variance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jaPuryOA6gQ-XNE6Gh_76g.png" /><figcaption>Image build using ChatGPT</figcaption></figure><p>You don’t need to memorize the theory to use variance like a pro — you just need a simple mental model.<br>This guide gives you that model.</p><p>If you’ve ever wondered why:</p><ul><li>List&lt;Int&gt; works where List&lt;Number&gt; is expected</li><li>MutableList&lt;Int&gt; <strong>does not</strong></li><li>Comparator&lt;Number&gt; can act as a Comparator&lt;Int&gt;</li><li>or what in, out, and invariance really mean</li></ul><p>…this article will make Kotlin variance finally click.</p><h3>1. Why Variance Matters</h3><p>Variance determines <strong>how one generic type relates to another</strong> when their type parameters are in a subtype relationship.</p><p>In other words:</p><blockquote><em>If </em><em>Int is a subtype of </em><em>Number, can<br> </em><em>Box&lt;Int&gt; be treated as </em><em>Box&lt;Number&gt;?</em></blockquote><p>Sometimes yes, sometimes no — and variance is the reason.</p><p>Understanding this makes you better at:</p><ul><li>designing clean APIs</li><li>reading Kotlin standard library code</li><li>passing interviews</li><li>avoiding subtle runtime errors</li></ul><p>Let’s start with the problem variance solves.</p><h3>2. The Problem Variance Solves</h3><p>Consider a simple mutable wrapper:</p><pre>class Box&lt;T&gt;(var value: T)</pre><p>Intuitively, you might think:</p><blockquote>“Int is a Number, so Box&lt;Int&gt; should be a Box&lt;Number&gt;, right?”</blockquote><p>But if Kotlin allowed this, things get unsafe quickly.</p><p>❌ Imagine this was legal:</p><pre>val intBox: Box&lt;Int&gt; = Box(10)</pre><pre>val numBox: Box&lt;Number&gt; = intBox   // hypothetically allowed</pre><p>Now someone working with numBox does this:</p><pre>numBox.value = 3.14     // inserting Double into Box&lt;Int&gt;</pre><p>And then:</p><pre>val x: Int = intBox.value    // BOOM</pre><p>Kotlin prevents this at <strong>compile time</strong> by making some generic types <strong><em>invariant</em></strong>.</p><p>This brings us to variance.</p><h3>3. A Simple Mental Model: Flow of Types</h3><p>Before we go deeper, here’s the easiest way to understand variance:</p><p><strong>Think of the type hierarchy as a vertical flow:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5K9Axufl7As5A8EhAFC7Tw.jpeg" /><figcaption>Generated using Figma and Gemini</figcaption></figure><p>Now:</p><ul><li><strong>Covariance (</strong><strong>out)</strong> → the flow goes <em>upward</em> (subtype → supertype)</li><li><strong>Contravariance (</strong><strong>in)</strong> → the flow goes <em>downward</em> (supertype → subtype)</li><li><strong>Invariance</strong> → no flow allowed</li></ul><p>Keep this mental image with you — it makes everything below intuitive.</p><h3>4. Covariance (out) — Producers</h3><p>Covariance means:</p><blockquote><em>When </em><em>A is a subtype of </em><em>B,<br> </em><strong><em>Producer&lt;A&gt;</em></strong><em> can be used where </em><strong><em>Producer&lt;B&gt;</em></strong><em> is expected.</em></blockquote><p>You mark it with:</p><pre>interface Producer&lt;out T&gt; {<br>    fun get(): T<br>}</pre><p>A covariant type <strong>only produces</strong> values of type T.<br>It never accepts them — so subtype substitution is always safe.</p><p><strong>Example</strong></p><pre>val intProducer: Producer&lt;Int&gt; = ...<br>val numProducer: Producer&lt;Number&gt; = intProducer   // ✔ allowed</pre><p><strong>Real-world Kotlin example</strong></p><pre>val ints: List&lt;Int&gt; = listOf(1, 2, 3)<br>val nums: List&lt;Number&gt; = ints    // ✔ List is covariant</pre><p>List is read-only → a perfect example of a producer.</p><h3>5. Contravariance (in) — Consumers</h3><p>Contravariance means:</p><blockquote><em>When </em><em>A is a subtype of </em><em>B,<br> </em><strong><em>Consumer&lt;B&gt;</em></strong><em> can be used where </em><strong><em>Consumer&lt;A&gt;</em></strong><em> is expected.</em></blockquote><p>You mark it with:</p><pre>interface Consumer&lt;in T&gt; {<br>    fun accept(value: T)<br>}</pre><p>A contravariant type <strong>only consumes</strong> values of type T.</p><p><strong>Example</strong></p><pre>val numConsumer: Consumer&lt;Number&gt; = ...<br>val intConsumer: Consumer&lt;Int&gt; = numConsumer   // ✔ allowed</pre><h4>Real-world Kotlin example</h4><pre>val numberComparator: Comparator&lt;Number&gt; = ...<br>val intComparator: Comparator&lt;Int&gt; = numberComparator   // ✔ allowed</pre><p>Comparators <strong>consume</strong> values <strong>→</strong> perfect match.</p><h3>6. Invariance — When a Type Is Both Producer and Consumer</h3><p>If a class both reads <strong>and</strong> writes the type parameter, Kotlin forces invariance.</p><p>Example:</p><pre>class Box&lt;T&gt;(var value: T)</pre><p>Because Box allows both:</p><ul><li>getting T</li><li>setting T</li></ul><p>…it’s unsafe to treat Box&lt;Int&gt; as Box&lt;Number&gt; or vice versa.</p><pre>val intBox: Box&lt;Int&gt; = Box(1)<br>// val numBox: Box&lt;Number&gt; = intBox   // ❌ not allowed</pre><p>This prevents type pollution and runtime crashes.</p><h3>✅ Use-Site Variance</h3><p>Sometimes you <strong>cannot change the original generic class</strong> (like Box&lt;T&gt;),<br>but you still want to <strong>restrict how it’s used</strong> at a specific call site.</p><p>Kotlin allows this using <strong>use-site variance</strong>, also called <strong>type projections</strong>.</p><pre>// Use-site variance with safer naming<br><br>fun readOnlyView(source: Box&lt;out Number&gt;, target: MutableList&lt;Number&gt;) {<br>    // This box behaves like a read-only producer of Number<br><br>    target.add(source.get())   // ✅ Allowed: reading as Number is safe<br><br>    // source.set(50)          // ❌ Not allowed: write is blocked by projection<br>}<br><br>fun writeOnlyView(destination: Box&lt;in Number&gt;, input: List&lt;Int&gt;) {<br>    // This box behaves like a write-only consumer of Number<br><br>    destination.set(input.first())   // ✅ Allowed: Int is accepted as Number<br><br>    val result: Any? = destination.get()   // ✅ Allowed, but only as Any?<br><br>    // val num: Number = destination.get() // ❌ Not allowed: return type is too generic<br>}</pre><h3>7. How the Kotlin Standard Library Uses Variance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqG6lrVOXoMyXgs-EgnKxw.png" /><figcaption>Generated using Figma AI</figcaption></figure><p>Notice a pattern:</p><blockquote><em>Only-producers → </em><em>out<br>Only-consumers → </em><em>in<br>Both → invariant</em></blockquote><p>This rule guides API design in the Kotlin ecosystem.</p><h3>8. Quick Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*24fiReZXg-GC2iszS3VyzQ.png" /><figcaption>Generated using Figma AI</figcaption></figure><h3>Cheat Sheet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJfRR_x9gl5-XO8e2-MiqA.png" /><figcaption>Generated using Gemini Nano Banana</figcaption></figure><h3>Closing Thoughts</h3><p>Variance isn’t something you need to memorize.<br>Once you understand how type flow works — up, down, or not at all — the rules become obvious.</p><p>If this mental model helped you, follow me for more Kotlin deep-dives, Android insights, and practical developer guides.</p><p><a href="https://www.linkedin.com/in/shashank-s-pednekar/">🔗 Let’s connect on LinkedIn:</a> <a href="https://www.linkedin.com/in/shashank-s-pednekar/">Shashank Pednekar | LinkedIn</a></p><p>🐦 Follow me on Twitter (X): <a href="https://x.com/ShashankP27">https://x.com/ShashankP27</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ec10d5fec20" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/stop-memorizing-in-and-out-use-this-simple-mental-model-for-kotlin-variance-4ec10d5fec20">Stop Memorizing ‘in&#39; and ‘out&#39;: Use This Simple Mental Model for Kotlin Variance</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Experience Isn’t Enough: The Case for Mastering Programming Fundamentals]]></title>
            <link>https://pednekarshashank33.medium.com/why-experience-isnt-enough-the-case-for-mastering-programming-fundamentals-f87188420aac?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/f87188420aac</guid>
            <category><![CDATA[core-concepts]]></category>
            <category><![CDATA[fundamentals]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Mon, 26 May 2025 11:08:39 GMT</pubDate>
            <atom:updated>2025-05-26T11:08:39.920Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*41VX4mnqXtL8BtoEnVnNxQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@harrisonchang?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Harrison Chang</a> on <a href="https://unsplash.com/photos/a-close-up-of-a-piece-of-paper-with-a-pen-on-it-IJkTwVCezJc?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><h3>👋 Why this article?</h3><p>Recently, I’ve been interviewing candidates for experienced Android developer roles. I noticed that while many developers are great at building features, some find it challenging to explain the <em>why</em> behind their code, especially when handling edge cases. That got me thinking.</p><p>Even after years of experience, many of us focus on delivering features but don’t always give enough attention to the underlying concepts that power those features. This post is my attempt to shine some light on the importance of fundamentals and how investing in them can pay off big time.</p><p>Whether you’re an Android developer or working with any other platform, this applies to all of us.</p><h3>What Happens When Fundamentals Are Lacking</h3><blockquote><em>“Programming fundamentals aren’t just theory — they’re the blueprint for writing efficient, scalable, and maintainable software.”</em></blockquote><p>Here’s what I’ve seen first-hand (and I’m sure you have too):</p><h4>- Debugging becomes guesswork</h4><p>Without understanding object lifecycles, memory management, or concurrency, debugging turns into trial-and-error instead of targeted, informed problem-solving.</p><h4>- Poor problem-solving ability</h4><p>When fundamentals are weak, breaking down a complex problem becomes overwhelming. A strong foundation makes it easier to simplify, analyze, and build better solutions.</p><h4>- Fragile and inefficient code</h4><p>A developer with solid fundamentals writes cleaner, more reliable code that anticipates edge cases and performs well in unexpected scenarios.</p><h4>- Difficult to maintain and scale</h4><p>Ever been scared of a small feature request because it might break something else? Yeah… me too 😅<br>But when your architecture and logic are rooted in strong principles, change is easier — and less terrifying.</p><h4>- Performance takes a hit</h4><p>Understanding data structures and algorithms (DSA) helps you write faster, memory-efficient code.<br>Even I’m working on brushing up my DSA skills these days 😉 — because it’s never too late to improve.</p><h4>- Slower to learn new tools or frameworks</h4><p>New technology is less intimidating when you already understand the concepts behind it. A solid foundation gives you the confidence to adapt.</p><h3>🌱 How Fundamentals Prepare You for Long-Term Growth</h3><ul><li><strong>Identify &amp; fix issues faster</strong>: You can debug smarter, not harder.</li><li><strong>Writing more efficient code: </strong>Handling edge cases is easier, leading to more stable apps.</li><li><strong>Solve problems better</strong>: You can break down complexity into manageable pieces.</li><li><strong>Understand performance trade-offs</strong>: You can write code that’s faster and uses memory more efficiently.</li><li><strong>Maintain and scale confidently</strong>: Changes won’t feel like ticking time bombs 💣 (“but it was working yesterday!” 😅).</li><li><strong>Learn faster</strong>: Once you understand the basics, new frameworks and languages make a lot more sense.</li><li><strong>Make better decisions</strong>: You’ll be able to contribute meaningfully to architecture, estimations, and tool selection.</li></ul><h3>🛠️ How to Rebuild or Strengthen Your Foundation</h3><p>The good news? It’s never too late — and it doesn’t have to be scary. Here’s how to get started:</p><h4>1. Revisit OOP — with real-world analogies</h4><p>Don’t just memorize definitions. Try to understand inheritance, polymorphism, and encapsulation through real-life examples — then implement them in code.</p><h4>2. Understand object lifecycle</h4><p>Especially for Android, but also relevant in other frameworks. Know when things are created, reused, and destroyed.</p><h4>3. Work on your DSA, bit by bit</h4><p>Pick one small problem daily — arrays, recursion, sorting, etc.<br>Even if you’re not prepping for interviews, you’ll notice the improvement in how you write code. Consistency is the key.<br><em>Even I’m working on brushing up my DSA skills these days 😉</em></p><h4>4. Go beyond tutorials</h4><p>Tutorials teach you <em>what</em> to do. Docs, architecture blogs, and source code show you <em>why</em> and <em>how</em> things work. Make time for those deeper reads.</p><h4>5. Explore design patterns</h4><p>Design patterns like Strategy, Factory, and DAO will help you understand abstraction and write more flexible code that can handle future changes with ease.</p><h3>📚 Reference link:</h3><p><a href="https://www.alooba.com/skills/concepts/programming/programming-fundamentals/">Programming Fundamentals: Everything You Need to Know When Assessing Programming Fundamentals Skills</a></p><h3>📝 Final Thoughts</h3><p>We’ve all been there — focused on shipping features, hitting deadlines, and just making things work. But giving a little time to the basics can truly unlock the next level in your developer journey.</p><p>Let me know how you’re approaching this journey — or drop your thoughts, resources, or tips in the comments. 👇<br>If you’d like to connect or continue the conversation, feel free to reach out:</p><ul><li>💼 <a href="https://www.linkedin.com/in/shashank-s-pednekar/">Connect on LinkedIn</a></li><li>🐦 <a href="https://x.com/ShashankP27">Follow me on X (Twitter)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f87188420aac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android 10’s Scoped Storage: Image Picker (Gallery/Camera)]]></title>
            <link>https://pednekarshashank33.medium.com/android-10s-scoped-storage-image-picker-gallery-camera-d3dcca427bbf?source=rss-3766338e2857------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3dcca427bbf</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-10]]></category>
            <category><![CDATA[scoped-storage]]></category>
            <dc:creator><![CDATA[Shashank Pednekar]]></dc:creator>
            <pubDate>Sun, 10 Nov 2019 14:49:12 GMT</pubDate>
            <atom:updated>2021-03-16T06:30:52.306Z</atom:updated>
            <content:encoded><![CDATA[<p>To give users more control over their files and to limit file clutter, apps targeting Android 10 (API level 29) and higher are given scoped access into an external storage device, or <em>scoped storage</em>, by default. Such apps can see only their <em>app-specific directory</em> accessed using <a href="https://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)">Context.getExternalFilesDir()</a> and specific types of media. It&#39;s a best practice to use scoped storage unless your app needs access to a file that doesn&#39;t reside in either the app-specific directory or the <a href="https://developer.android.com/reference/android/provider/MediaStore">MediaStore</a>.</p><h3><strong>Why Scoped Storage</strong></h3><p>First and foremost, it stops malicious apps that depend on the user for granting access to their sensitive data because they did not read what they saw in the dialog and just clicked on allow. It also allows a developer to have their own space on the storage of your device that is private without asking for any specific permissions and no other app can access any document it creates without user granting temporary permissions.</p><p>Another reason to do this is because when an application having storage permissions, creates files or folders they get scattered all over user’s storage directory making it cluttered, and if the user decides to uninstall the app the files / folders that were created by the app still exist in that same location, unless you manually delete those files / folders once you’re done using them.</p><h3><strong>Can I opt out of Scoped Storage?</strong></h3><p>Yes, you can opt out temporarily by using following methods:</p><ul><li>Target Android 9 (API level 28) or lower.</li><li>If you target Android 10 or higher, set the value of requestLegacyExternalStorage to true in your app&#39;s manifest file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*lbdN1cj2_AqymZE0hK7nSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*PSa36QmV-z67rKFBrrWqBQ.jpeg" /></figure><blockquote>As per Google Play requirements, to provide users with the best Android experience possible, the Google Play Console will continue to require that apps target a recent API level. Apps will be required to use scoped storage in next year’s major platform release for all apps, independent of target SDK level. Therefore, you should ensure that your app works with scoped storage well in advance.</blockquote><h3><strong>So, what’s the solution?</strong></h3><p>Talking about solution, it’s not exactly new, but it is now strictly enforced and no longer optional. With Android 4.4 (Api 19) introduces the <a href="https://developer.android.com/guide/topics/providers/document-provider">Storage Access Framework</a> (SAF). This gave apps a way to access files in other folders using an Android API instead of using standard programming file operations.</p><p>Following types of files within an external storage device without needing to request any<strong> storage-related user permissions</strong>:</p><ul><li>Files in the app-specific directory, accessed using <a href="https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)">getExternalFilesDir()</a>.</li><li>Photos, videos, and audio clips that the app created from the <a href="https://developer.android.com/training/data-storage/files/media">media store</a>.</li></ul><p>I’m going to explain scoped storage changes using example of Image picker(Gallery/Camera) with compression. You can find source code <a href="https://github.com/ShashankPednekar/ImagePicker-and-Compression">here</a>.</p><p><strong>Creating file directory URI using FileProvider</strong></p><p>To capture image we have to create external file directory using <a href="https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)">getExternalFilesDir(Environment.<em>DIRECTORY_DCIM</em></a><em>) and create uri from it.</em></p><blockquote>There are other Environment variables also available like <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_MUSIC">Environment.DIRECTORY_MUSIC</a>, <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_PODCASTS">Environment.DIRECTORY_PODCASTS</a>, <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_RINGTONES">Environment.DIRECTORY_RINGTONES</a>, <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_ALARMS">Environment.DIRECTORY_ALARMS</a>, <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_NOTIFICATIONS">Environment.DIRECTORY_NOTIFICATIONS</a>, <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_PICTURES">Environment.DIRECTORY_PICTURES</a>, or <a href="https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_MOVIES">Environment.DIRECTORY_MOVIES</a>. This type value can be null for the root of the files directory. Use as per your requirements.</blockquote><p><em>But passing </em><em>file:// URIs outside the package domain may leave the receiver with an inaccessible path. Therefore, attempts to pass a </em><em>file:// URI trigger a </em><em>FileUriExposedException. The recommended way to share the content of a private file is using the </em><a href="https://developer.android.com/reference/android/support/v4/content/FileProvider.html"><em>FileProvider</em></a><em>.</em></p><p><em>Following steps for create FileProvider:</em></p><ol><li>Android Manifest</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8feac247b0c599b2a0e845a7082267d6/href">https://medium.com/media/8feac247b0c599b2a0e845a7082267d6/href</a></iframe><p>2. Specifying available files</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b371ddc61aee2ee62c17a93e191f651b/href">https://medium.com/media/b371ddc61aee2ee62c17a93e191f651b/href</a></iframe><p>3. Generating content URI for a file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e70941522448b750837b48efbcd0ac12/href">https://medium.com/media/e70941522448b750837b48efbcd0ac12/href</a></iframe><p><strong>Take a photo or Select Image from gallery</strong></p><p>Here we’re using Intent.createChooser()to take a photo using camera and select image from gallery.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e9f0de4e920bfe6fe6097502194b59b/href">https://medium.com/media/3e9f0de4e920bfe6fe6097502194b59b/href</a></iframe><p><strong>Read Bitmap from URI</strong></p><p>In <a href="https://developer.android.com/reference/android/app/Activity.html#onActivityResult(int,%20int,%20android.content.Intent)">onActivityResult()</a> intentData parameter contains URI if user selects image from gallery, otherwise data will be available in imageUri which we were created earlier.</p><blockquote><em>Note: You should not do this operation on UI thread. Do it in the background thread. For this I used </em><a href="https://developer.android.com/kotlin/coroutines"><em>Coroutines</em></a><em>, its simple and easy to use.</em></blockquote><p>To start image processing, we need to get bitmap from uri/path. Earlier we were using <a href="https://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeFile(java.lang.String)">BitmapFactory.decodeFile(path)</a>, but it return null for external files. So, we have to use following method to get bitmap by using <a href="https://developer.android.com/guide/topics/providers/document-provider#bitmap">SAF</a> method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fdbc847a765716e5de07e00e9c27bd7/href">https://medium.com/media/3fdbc847a765716e5de07e00e9c27bd7/href</a></iframe><p><strong>Use URI outside Activity Scope</strong></p><p>Once the user select image from gallery, your app can return its content URI in onActivityResult(). You have access to the content of URI from the Activity that receives the URI. You can pass this access to other components of your app or even components of other apps by setting Intent flag as follows:</p><ul><li>Call the method <a href="https://developer.android.com/reference/android/content/Context.html#grantUriPermission(java.lang.String,%20android.net.Uri,%20int)">Context.grantUriPermission(package, Uri, mode_flags)</a> for the content:// Uri, using the desired mode flags. This grants temporary access permission for the content URI to the specified package, according to the value of the mode_flags parameter, which you can set to <a href="https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION">Intent.FLAG_GRANT_READ_URI_PERMISSION</a>, <a href="https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION">Intent.FLAG_GRANT_WRITE_URI_PERMISSION</a> or both. The permission remains in effect until you revoke it by calling <a href="https://developer.android.com/reference/android/content/Context.html#revokeUriPermission(android.net.Uri,%20int)">revokeUriPermission()</a> or until the device reboots.</li><li>Put the content URI in an Intent by calling setData().</li><li>Next, call the method <a href="https://developer.android.com/reference/android/content/Intent.html#setFlags(int)">Intent.setFlags()</a> with either <a href="https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION">Intent.FLAG_GRANT_READ_URI_PERMISSION</a> or <a href="https://developer.android.com/reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION">Intent.FLAG_GRANT_WRITE_URI_PERMISSION</a> or both.</li><li>Finally, send the <a href="https://developer.android.com/reference/android/content/Intent.html">Intent</a> to another app. Most often, you do this by calling setResult().</li><li>Permissions granted in an Intent remain in effect while the stack of the receiving Activity is active. When the stack finishes, the permissions are automatically removed. Permissions granted to one Activity in a client app are automatically extended to other components of that app.</li></ul><pre><strong>val</strong> intent = Intent(<strong>this</strong>, AnotherActivity<strong>::class</strong>.java)<br>  .setData(uri)<br>  .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)<br>  .addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)<br><br>startActivity(intent)</pre><p><strong>Persist URI Permission</strong></p><p>URI permission lasts until the user’s device restarts. To prevent this you can use contentResolver.takePersistableUriPermission()as follows:</p><pre>val takeFlags: Int = intent.flags and<br>        (Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)<br>contentResolver.takePersistableUriPermission(uri, takeFlags)</pre><p><a href="https://developer.android.com/training/basics/intents/package-visibility#intent-signature"><strong>Manage Package visibility</strong></a><strong> on Android 11</strong></p><p>Add the following code in the manifest file:</p><pre>&lt;manifest &gt;<br>...<br>&lt;queries&gt;<br> &lt;intent&gt;<br>  &lt;action android:name=&quot;android.media.action.IMAGE_CAPTURE&quot; /&gt;<br> &lt;/intent&gt;</pre><pre> &lt;intent&gt;<br>  &lt;action android:name=&quot;android.intent.action.PICK&quot; /&gt;<br>  &lt;data android:mimeType=&quot;image/*&quot; /&gt;<br> &lt;/intent&gt;</pre><pre>&lt;/queries&gt;<br>...<br>&lt;/manifest&gt;</pre><p>Following source code for a complete example of image picker with compression:</p><p><a href="https://github.com/ShashankPednekar/ImagePicker-and-Compression.git">ShashankPednekar/ImagePicker-and-Compression</a></p><p>References:</p><pre><a href="https://developer.android.com/training/data-storage/files/external-scoped">https://developer.android.com/training/data-storage/files/external-scoped</a></pre><pre><a href="https://developer.android.com/guide/topics/providers/document-provider">https://developer.android.com/guide/topics/providers/document-provider</a></pre><pre><a href="https://www.androidcentral.com/what-scoped-storage-android-q">https://www.androidcentral.com/what-scoped-storage-android-q</a></pre><p>If there are any questions or feedback regarding this post then please do reach out.</p><p><a href="https://twitter.com/ShashankP27">Shashank Pednekar</a></p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3dcca427bbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>