<?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 Fredrik A on Medium]]></title>
        <description><![CDATA[Stories by Fredrik A on Medium]]></description>
        <link>https://medium.com/@fredrikaldgard?source=rss-dff9947715f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IFhCFtE4GxX8J4rAGxgToQ.jpeg</url>
            <title>Stories by Fredrik A on Medium</title>
            <link>https://medium.com/@fredrikaldgard?source=rss-dff9947715f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:11:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fredrikaldgard/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[Easy Android: Launch screen]]></title>
            <link>https://medium.com/android-news/easy-android-launch-screen-39668f786004?source=rss-dff9947715f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/39668f786004</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Fredrik A]]></dc:creator>
            <pubDate>Tue, 08 Mar 2016 14:30:22 GMT</pubDate>
            <atom:updated>2016-03-08T14:30:50.252Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, we are going to have a look at the splash screen of Android, the <em>Launch screen</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*bcTRI6YeqyzwL6sSqL1Rlg.png" /><figcaption>A branded launch screen</figcaption></figure><h4>Understanding the launch screen</h4><p>First of all, what is a launch screen? Well it is basically the same thing as a splash screen, but with a different name.</p><p>The most important thing however is to understand how the launch screen should work and how to implement it in the correct way.</p><p>According to the Material Design guidelines:</p><blockquote>“The launch screen is a user’s first experience of your application.”</blockquote><p>Okay, so from reading this line, the launch screen seems very important and something that you really shouldn’t mess up with…?!? And that is correct. The launch screen is the very first thing that the user associate your app with, therefor, it is very important that you don’t implement it in the wrong way.</p><p>The launch screen’s <strong>main function </strong>is to act as a <strong>placeholder</strong> until the rest of your app has loaded.</p><p>As you can see below (from my app <a href="https://play.google.com/store/apps/details?id=com.heavyfork.partystarter">Party Starter</a>) the launch screen acts like a <strong>placeholder</strong> until the rest of the UI is ready.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fthumbs.gfycat.com%2FPlainTameAsiandamselfly-mobile.mp4&amp;src_secure=1&amp;url=https%3A%2F%2Fgfycat.com%2FPlainTameAsiandamselfly&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FPlainTameAsiandamselfly-thumb100.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=video%2Fmp4&amp;schema=gfycat" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f82aa8302ef875c0da0f683d6a10b95/href">https://medium.com/media/8f82aa8302ef875c0da0f683d6a10b95/href</a></iframe><p>This app isn’t very heavy and doesn’t take very long to load - the launch screen isn’t being shown for long.</p><p><strong>However</strong>, if the app launches for the first time after being installed from Google Play then the loading takes considerably longer and instead of showing the user a blank canvas of nothing, we chose to to show a launch screen with our brand until the app has finished loading. <strong>Remember</strong>, the launch screen is the first thing that the user experiences with your app. A more detailed view of what is happening is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i-jv3h80xGIzmNbz5qLjEA.png" /><figcaption>User opens the app — launch screen is shown and loads the app in the background — final UI is ready</figcaption></figure><h4>What the launch screen is not</h4><p>It is important to remember that the launch screen is <strong>firstly </strong>a placeholder, <strong>secondly</strong> a place to advertise your brand at.</p><p><strong>Do not show the launch screen if you don’t have to.</strong></p><p>You should not in any way display the launch screen if it not necessary, the user will see the launch screen as something that slows down the user experience rather than a placeholder. If the app is already loaded in the phone’s memory, skip the launch screen and head directly to the UI.</p><p><strong>And lastly</strong>, implement the launch screen so that it is the first thing that the user sees. Do not show the launch screen after displaying a blank canvas as shown below. That is not the way to go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gpcHBU96X7lJ7d9hf0kksQ.png" /><figcaption>A big no-no!</figcaption></figure><h4>The code</h4><p>After we have learned what a launch screen is, it is time to do the coding part. This is super simple and doesn’t require a single line of Java, amazing isn’t it? We are actually going to work with themes!</p><p>In your <strong>styles.xml:<br></strong>Create a new theme style that looks like your existing but add this line to the style:</p><pre>&lt;<strong>item name=”android:windowBackground”</strong>&gt;@drawable/launch_screen&lt;/<strong>item</strong>&gt;</pre><p>It should look like this:</p><pre><em>&lt;--! styles.xml --&gt;</em></pre><pre>&lt;<strong>style name=&quot;PartyTheme&quot; parent=&quot;Theme.AppCompat.NoActionBar&quot;</strong>&gt;<br><em>    </em>&lt;<strong>item name=&quot;windowNoTitle&quot;</strong>&gt;true&lt;/<strong>item</strong>&gt;<br>    &lt;<strong>item name=&quot;colorPrimary&quot;</strong>&gt;@color/pink500&lt;/<strong>item</strong>&gt;<br>    &lt;<strong>item name=&quot;colorPrimaryDark&quot;</strong>&gt;@color/transparentToolbar&lt;/<strong>item</strong>&gt;<br>    &lt;<strong>item name=&quot;colorAccent&quot;</strong>&gt;@color/pink500&lt;/<strong>item</strong>&gt;<br>    &lt;<strong>item name=&quot;android:windowBackground&quot;</strong>&gt;@drawable/launch_screen&lt;/<strong>item</strong>&gt;<br><br>&lt;/<strong>style</strong>&gt;</pre><p>Next up is to create a drawable that acts like our background to the style that we just created. Right click on your drawable folder &gt; <em>New</em> &gt; <em>Drawable resource file. </em>Paste the following code to the new file:</p><pre><em>&lt;--! launch_screen.xml --&gt;</em></pre><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;</strong><em>?&gt;<br><br></em>&lt;<strong>layer-list xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;</strong>&gt;<br>    &lt;<strong>item</strong>&gt;<br>        &lt;<strong>color android:color=&quot;@color/background_material_light&quot;</strong>/&gt;<br>    &lt;/<strong>item</strong>&gt;<br>    &lt;<strong>item</strong>&gt;<br>        &lt;<strong>bitmap<br>            android:src=&quot;@drawable/launch_logo&quot;<br>            android:tileMode=&quot;disabled&quot;<br>            android:gravity=&quot;center&quot;</strong>/&gt;<br>    &lt;/<strong>item</strong>&gt;<br>&lt;/<strong>layer-list</strong>&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1_8UyEZo4HHC8Ki5BnAJw.png" /></figure><p>As you can see, this drawable has a background colour and a bitmap with our logo in the middle. Remember to set the bitmap’s gravity to center if you want it to located in the center of the screen.</p><p>Now, go to your manifest and change the theme of the launch activity to the style we created earlier.</p><pre>&lt;--! AndroidManifest.xml --&gt;</pre><pre>&lt;activity<br>    android:name=&quot;.MainActivity&quot;<br>    android:label=&quot;@string/app_name&quot;<br>    <strong>android:theme=&quot;@style/PartyTheme&quot;</strong> &gt;</pre><pre>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;<br>        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;    &lt;/intent-filter&gt;</pre><pre>&lt;/activity&gt;</pre><p>You are now done.</p><p>Now your style’s background will display the launch screen. And because of the order that Android shows the different parts of the app, the launch screen will now be shown instead of a blank canvas when to app is being loaded, cool right?</p><h4>Final notes</h4><p>Depending on how your MainActivity look like, you might need to change the background colour of your RelativeLayout/LinearLayout/etc to the original colour that you had previously.</p><p>Creating a launch screen is a very task to do and gives your app a more branded look (if that is what you want). Implementing a launch screen in the correct way does not only make your app look better, it also functions as it should: <strong>as a placeholder.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39668f786004" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/easy-android-launch-screen-39668f786004">Easy Android: Launch screen</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Easy Android: Shared Element Transition]]></title>
            <link>https://medium.com/android-news/easy-android-shared-element-transition-ac36952a4a4?source=rss-dff9947715f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac36952a4a4</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Fredrik A]]></dc:creator>
            <pubDate>Wed, 15 Jul 2015 10:43:16 GMT</pubDate>
            <atom:updated>2015-09-17T16:53:37.739Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fzippy.gfycat.com%2FQuarterlyWhirlwindGoldfish.mp4&amp;src_secure=1&amp;url=http%3A%2F%2Fgfycat.com%2FQuarterlyWhirlwindGoldfish&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FQuarterlyWhirlwindGoldfish-thumb100.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=video%2Fmp4&amp;schema=gfycat" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/a316217f510a582f4f42d2b18ae34c1f/href">https://medium.com/media/a316217f510a582f4f42d2b18ae34c1f/href</a></iframe><p>Developing apps for Android can be frustrating, hard and will sometimes <a href="http://www.mat-d.com/site/wp-content/uploads/wrong.jpg">drive you mad</a>. Learning new things within Android development can also be difficult. Sure, Stackoverflow is an awesome source when it comes to learning code and Google is also covering a lot of things, but sometimes you just want a simple tutorial with as less code as possible and that is why I created Easy Android. This series will cover everything from animations to Snackbars, just like any other tutorial site, but way more understandable. I will cover you with the code necessary to succeed and some explanations (but I won’t get too technical here, this is supposed to be easy).</p><p>So who am I? Well, my name is Fredrik and I am an amateur Android developer. I mainly do icon packs when developing by myself. Together with two of my friends, we have created “company” called <a href="https://play.google.com/store/apps/developer?id=HeavyFork">HeavyFork</a>. With HeavyFork, I have developed a quite successful <a href="https://play.google.com/store/apps/details?id=com.heavyfork.square">icon pack</a> and a <a href="https://play.google.com/store/apps/details?id=com.fredrikaldgard.materialcolors">colour app</a>. We are also working on a small little game that will be <a href="https://play.google.com/store/apps/developer?id=HeavyFork">released soon</a>.</p><h4>Preparations</h4><p>Did you read the first part? No, I thought so. Well, you didn’t miss anything necessary for creating this awesome transition effect that was introduced in Android 5.0.</p><p>First things first. You will only see this effect when running your app with a phone running Lollipop or later (SDK 21).</p><p>Make sure that you have created two activities as well!</p><h4>Shared Element Transition</h4><p>Shared Element Transition can be described liked this: <em>Having a view that moves from one activity to another in a smooth motion. </em>Doing this in Android 4.4 and below was a pain in the ass to be fair. But this all changed when Google released Android 5.0, more animations to the people!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fxvy7KUe492g%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dxvy7KUe492g%26feature%3Dyoutu.be&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fxvy7KUe492g%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a5b80266126fc6ed55a23b632c3b0e3/href">https://medium.com/media/0a5b80266126fc6ed55a23b632c3b0e3/href</a></iframe><p>This video shows what we want to create. When the user clicks on the card, he/she gets taken to the next activity with a nice animation. The card expands smoothly into a blue background. When the user navigates back, the background shrinks back into a card.</p><h4>Let’s code!</h4><p>OK, so now for the coding part.</p><p>Start of by enabling <strong>windowContentTranistion</strong> to your theme in styles.xml. This will only work for &gt;SDK 21 so consider making a styles-v21.xml that will enable this for every device running Android 5.0 or higher.</p><pre><em>&lt;!-- styles.xml --&gt;</em></pre><pre>&lt;<strong>style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;</strong>&gt;</pre><pre>        <em>&lt;!-- Add this line --&gt;<br>        </em>&lt;<strong>item name=&quot;android:windowContentTransitions&quot;</strong>&gt;true&lt;/<strong>item</strong>&gt;<br><br>&lt;/<strong>style</strong>&gt;</pre><p>After that, create a string in strings.xml that is uniqe.</p><pre>&lt;!-- strings.xml --&gt;</pre><pre>&lt;<strong>string name=&quot;transition_string&quot;</strong>&gt;hello&lt;/<strong>string</strong>&gt;</pre><p>Go to the views that you want to animate and set the <strong>transitionName</strong> to the string that you previously created. In my example, I have a CardView that is animated into a RelativeLayout but you can do this with ImageView, TextView, you name it!</p><p>I also have an onClick on the CardView.</p><pre>&lt;!-- This is the first view in the first activity --&gt;</pre><pre>&lt;android.support.v7.widget.CardView <br>   <br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:card_view=&quot;http://schemas.android.com/apk/res-auto&quot;<br>    android:id=&quot;@+id/card_view&quot;<br>    card_view:cardBackgroundColor=&quot;#084072&quot;</pre><pre><strong>    </strong>android:clickable=&quot;true&quot;<strong><br>    android:onClick=&quot;animateIntent&quot;</strong></pre><pre><strong>    android:transitionName=&quot;@string/transition_string&quot;</strong></pre><pre>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;wrap_content&quot; &gt;</pre><p>Next activity:</p><pre>&lt;!-- This is the second view in the second activity --&gt;</pre><pre>&lt;RelativeLayout       <br> <br>    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;<br>    xmlns:tools=&quot;http://schemas.android.com/tools&quot;   <br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;match_parent&quot; <br><br>    <strong>android:transitionName=&quot;@string/transition_string&quot;</strong></pre><pre>    tools:context=&quot;com.fredrikaldgard.folded.NewsActivity&quot;<br>    android:background=&quot;#084072&quot;&gt;</pre><pre>&lt;/RelativeLayout&gt;</pre><p>Now for the Java part. We will create a new method that will run when you click on the CardView.</p><p>You only need to write code in the first activity, so in this case the MainActivity. Android handles the transition all by itself. And best of all? You don’t have to write a single line of code to deal with backwards compatibility, Android will just ignore the animation part on devices running a lower Android version than 5.0 (Lollipop) and handle it just like an ordinary Intent.</p><pre>// MainActivity</pre><pre><strong>public void </strong>animateIntent(View view) {<br><br>    <em>// Ordinary Intent for launching a new activity<br>    </em>Intent intent = <strong>new </strong>Intent(<strong>this</strong>, YourSecondActivity.<strong>class</strong>);<br><br>    <em>// Get the transition name from the string<br>    </em>String <strong>transitionName</strong> = getString(<strong>R.string.transition_string</strong>);<br><br>    <em>// Define the view that the animation will start from<br>    </em>View <strong>viewStart</strong> = findViewById(<strong>R.id.card_view</strong>);<br><br>    ActivityOptionsCompat options =<br>           <br>    ActivityOptionsCompat.<em>makeSceneTransitionAnimation</em>(<strong>this</strong>,<br>                    <strong>viewStart</strong>,   <em>// Starting view<br>                    </em><strong>transitionName</strong>    <em>// The String<br>            </em>);</pre><pre>    <em>//Start the Intent<br>    </em>ActivityCompat.<em>startActivity</em>(<strong>this</strong>, intent, options.toBundle());<br><br>}</pre><h4>That’s it!</h4><p>Now launch your application and look at that beautiful animation that you’ve just created. That wasn’t hard was it? This transition effect doesn’t require many lines of code and you applications will look so much better.</p><p>If you have any questions just submit a comment and I will try my best to answer it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac36952a4a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/easy-android-shared-element-transition-ac36952a4a4">Easy Android: Shared Element Transition</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>