<?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 Malith Wimalarathna on Medium]]></title>
        <description><![CDATA[Stories by Malith Wimalarathna on Medium]]></description>
        <link>https://medium.com/@malithmpw?source=rss-6c0088875a8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bDcfqG8pTfAqNy4oGq8VxA.png</url>
            <title>Stories by Malith Wimalarathna on Medium</title>
            <link>https://medium.com/@malithmpw?source=rss-6c0088875a8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 00:06:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malithmpw/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[Android Splash Screen: Proper way]]></title>
            <link>https://malithmpw.medium.com/android-splash-screen-proper-way-f3b7fc864693?source=rss-6c0088875a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b7fc864693</guid>
            <category><![CDATA[android-splash-screen]]></category>
            <category><![CDATA[splash-screen]]></category>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Malith Wimalarathna]]></dc:creator>
            <pubDate>Sat, 19 Mar 2022 17:53:17 GMT</pubDate>
            <atom:updated>2022-03-20T11:14:38.731Z</atom:updated>
            <content:encoded><![CDATA[<p>Splash Screen is the first thing users see when they launch the application and it’s a crucial screen for most of the apps and it allows the app to get things ready for a smooth session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*inJNoYRpqUAXtvhaDEOreA.png" /></figure><p>There are two ways of doing the splash screen and both have its pros and cons.</p><p><strong>1. Full-Screen Activity with a Timer (Traditional way) :</strong></p><p>This approach allows to create more complex and dynamic splash layout but this takes some time to render and users might see the splash after a small delay. also, users may see white or black ( or windowBackgroundColor ) background just before the splash’s screens layout is displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*w5_H3aldo2waQBzu-YeaOg.gif" /></figure><p><strong>2. Using a Launcher Theme for the activity ( timer if more time required )</strong></p><p>This is the fastest and proper way of using the splash while mitigating the above approach’s cons. But this limits having a dynamic splash( dynamic text, images.. etc) but still, you can create a complex splash using image resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*ELu26i7uj7LMjDOsCXkBgQ.gif" /></figure><h3><em>Did you know?</em></h3><blockquote><strong>When the Android OS calls for an activity, it first looks in the manifest whether any theme is declared for the activity and if so, load that theme before anything.</strong></blockquote><h3>Let’s get started, shall we?</h3><h4>Step 1</h4><p>Create a background resource file in <strong>drawable</strong> folder for splash screen and name it as <strong>splash_background.xml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/097f5fe41ae334ce5e18a0a3c0c61f2b/href">https://medium.com/media/097f5fe41ae334ce5e18a0a3c0c61f2b/href</a></iframe><h4>Step 2</h4><p>Create the <strong>gradient_bg.xml</strong>. Background can be a gradient, color or image.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bb1e58389dc88fa11c9bb92b6f6194e/href">https://medium.com/media/3bb1e58389dc88fa11c9bb92b6f6194e/href</a></iframe><h4>Step 3</h4><p>Create the <strong>SplashActivity.kt</strong> and set the theme in <strong>AndroidManifest.xml</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc88a299bc650eb6c646f0e83c89a2ab/href">https://medium.com/media/bc88a299bc650eb6c646f0e83c89a2ab/href</a></iframe><p>That’s it. Simple as that.</p><blockquote>Since we are using a theme to show the splash and style is defined in the manifest, We <strong>DO NOT</strong> need to use the <strong>setContentView()</strong> in the activity.</blockquote><h3>Happy coding… Hope it helped</h3><p>Connect with me on</p><p><a href="https://www.linkedin.com/in/malithwimalarathna/">Malith Wimalarathna - Senior Software Engineer - NTUC Enterprise Co-operative Limited | LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b7fc864693" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>