create account

Splash Screen | Android App Development | Lecture#49 | Hive Learners by faisalamin

View this thread on: hive.blogpeakd.comecency.com
· @faisalamin ·
$23.25
Splash Screen | Android App Development | Lecture#49 | Hive Learners
<center><h2>𝓖𝓻𝓮𝓮𝓽𝓲𝓷𝓰𝓼</h2></center>
<div class="text-justify">

Hello dear Hive Learners, We cover the firebase data push, retrieve and remove the data. Today we will learn a new very useful feature in Android App that is a splash screen. You can call it a Welcome screen or first impression of an App. It shows the company information for 1 or more seconds when a user opens the app as new. When a user opens an app after installing then after the splash screen we can show the intro pages. But today we will learn how to implement the splash screen for two seconds.

![](https://images.ecency.com/DQmY2nEVMQJUME8hjkoiTmXB7BGT6ksGZxQJBzCmxYTpopL/multi_purpose_9_.png)


### [GitHub Link](https://github.com/faisalamin9696/HiveLearners2)

Use this GitHub project to clone into your directory. The following lecture will update it so you will never miss the latest code. Happy Coding!

### What Should I Learn

- How to add Splash screen

### Assignment

- Implement the Splash screen

### Procedure

First of all, we need a logo. I am adding a Hive Learners logo in the resource folder. The location will be ```res> drawable```. Copy the Hive Learners logo and press paste it into the drawable folder of our project. Make sure that the name is in lowercase and does not contain any special character of space than the underscore```_``` symbol. My logo name is ```hive_learners.png```. Follow these steps.

![](https://images.ecency.com/DQmaVzpTfdD2eyTsWyctpSypNBV78nzMAoTiBdvhtt4ubqQ/image.png)

Paste it into the simple drawable folder

![](https://images.ecency.com/DQmdPyffNG29xvB8yBYbchmtHSXkuZKpVAdiQPw3dmpH82x/image.png)

![](https://images.ecency.com/DQmdc5Vgai2DU8oQo92Ckt2uYuRG6w6kBDaLUd3XLeknyqC/image.png)

Now we need to create a new empty activity and name it as Splash_Activity. Now enter in its XML file. Change the parent layout to Linear Layout and add gravity to the center. Add an ImageView and set it's the source of our logo. Also, set the scale type to center inside.

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical"
    tools:context=".Splash_Activity">

    <ImageView
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:scaleType="centerInside"
        android:src="@drawable/hive_logo" />


</LinearLayout>
```

![](https://images.ecency.com/DQmdtG7FiC7wtBNzDf65JXsufGdEScibiFQZhBK8UTq4MKC/image.png)

Now open Splash_Activity.java and write a code for a handler that will run for two seconds. After the 2 seconds, we will finish the Splash Activity and redirect the user to Login Page.

```
new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {

                // After two seconds 1000ms = 1 Second

            }
        }, 2000);
```

![](https://images.ecency.com/DQmch1Hea2kYUxeHGN1x7R1gnXa5vPiC5W9WrBYeSGRpqZU/image.png)


We need to redirect it to the Login Page after two seconds and finish this splash screen. So we will add these two lines in the run of the handler.

```
startActivity(new Intent(Splash_Activity.this, SignIn_Activity.class);
                finish();
```


![](https://images.ecency.com/DQmfN8nSrKFW4wTQBDrJST5fQo3reCCwNeGZ7bprShk3TP1/image.png)

The last thing we need to do is change the starting page in the manifest. Move the ```intent-filter``` code to the Splash Activity tag. Also, set exported to true.


![](https://images.ecency.com/DQmR1zHCZGdpQvifAS2VwcbMDBuYvVLB69YE73bqa68fyar/image.png)

Run the app and check the starting page of the app.</div>

![](https://images.ecency.com/DQmT3sZNJfucGDt6Wraq5WqRshzrcEEVXtsdLp4SEcNaGKq/image.png)

<center>
![hl_divider.png](https://images.ecency.com/DQmabQycJhW8DT8a634z3wQaVXvPZ5KMii2LYbaWZ3PsaRy/hl_divider.png)

<h2>Thank You</h2>

![hl_footer_banner.png](https://images.ecency.com/DQmZ4HF3hjV4HwJXuw8vRJ6B6CiMC3kUkkoihjtm7z2Gii7/hl_footer_banner.png)
<div class="pull-left"><a href="https://discord.gg/7Bzqv4qUMT">
<img src="https://cdn.steemitimages.com/DQmXd6PwGUHRgSDkWtwKfDvdFpaLHXvXBdK7wnYZeqe1GUa/discord_animation_logo.gif"/></a>
</center>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 238 others
properties (23)
authorfaisalamin
permlinksplash-screen-or-android-app
categoryhive-153850
json_metadata{"links":["https://github.com/faisalamin9696/HiveLearners2","http://schemas.android.com/apk/res/android","http://schemas.android.com/apk/res-auto","http://schemas.android.com/tools","https://discord.gg/7Bzqv4qUMT"],"image":["https://images.ecency.com/DQmY2nEVMQJUME8hjkoiTmXB7BGT6ksGZxQJBzCmxYTpopL/multi_purpose_9_.png","https://images.ecency.com/DQmaVzpTfdD2eyTsWyctpSypNBV78nzMAoTiBdvhtt4ubqQ/image.png","https://images.ecency.com/DQmdPyffNG29xvB8yBYbchmtHSXkuZKpVAdiQPw3dmpH82x/image.png","https://images.ecency.com/DQmdc5Vgai2DU8oQo92Ckt2uYuRG6w6kBDaLUd3XLeknyqC/image.png","https://images.ecency.com/DQmdtG7FiC7wtBNzDf65JXsufGdEScibiFQZhBK8UTq4MKC/image.png","https://images.ecency.com/DQmch1Hea2kYUxeHGN1x7R1gnXa5vPiC5W9WrBYeSGRpqZU/image.png","https://images.ecency.com/DQmfN8nSrKFW4wTQBDrJST5fQo3reCCwNeGZ7bprShk3TP1/image.png","https://images.ecency.com/DQmR1zHCZGdpQvifAS2VwcbMDBuYvVLB69YE73bqa68fyar/image.png","https://images.ecency.com/DQmT3sZNJfucGDt6Wraq5WqRshzrcEEVXtsdLp4SEcNaGKq/image.png"],"thumbnails":["https://images.ecency.com/DQmY2nEVMQJUME8hjkoiTmXB7BGT6ksGZxQJBzCmxYTpopL/multi_purpose_9_.png","https://images.ecency.com/DQmaVzpTfdD2eyTsWyctpSypNBV78nzMAoTiBdvhtt4ubqQ/image.png","https://images.ecency.com/DQmdPyffNG29xvB8yBYbchmtHSXkuZKpVAdiQPw3dmpH82x/image.png","https://images.ecency.com/DQmdc5Vgai2DU8oQo92Ckt2uYuRG6w6kBDaLUd3XLeknyqC/image.png","https://images.ecency.com/DQmdtG7FiC7wtBNzDf65JXsufGdEScibiFQZhBK8UTq4MKC/image.png","https://images.ecency.com/DQmch1Hea2kYUxeHGN1x7R1gnXa5vPiC5W9WrBYeSGRpqZU/image.png","https://images.ecency.com/DQmfN8nSrKFW4wTQBDrJST5fQo3reCCwNeGZ7bprShk3TP1/image.png","https://images.ecency.com/DQmR1zHCZGdpQvifAS2VwcbMDBuYvVLB69YE73bqa68fyar/image.png","https://images.ecency.com/DQmT3sZNJfucGDt6Wraq5WqRshzrcEEVXtsdLp4SEcNaGKq/image.png","https://images.ecency.com/DQmabQycJhW8DT8a634z3wQaVXvPZ5KMii2LYbaWZ3PsaRy/hl_divider.png","https://images.ecency.com/DQmZ4HF3hjV4HwJXuw8vRJ6B6CiMC3kUkkoihjtm7z2Gii7/hl_footer_banner.png","https://cdn.steemitimages.com/DQmXd6PwGUHRgSDkWtwKfDvdFpaLHXvXBdK7wnYZeqe1GUa/discord_animation_logo.gif"],"users":["Override"],"tags":["hive-153850","stem","education","neoxian","pakistan","development","android","firebase","programming"],"description":"","app":"ecency/3.0.25-vision","format":"markdown+html"}
created2022-08-19 14:40:06
last_update2022-08-19 14:40:06
depth0
children5
last_payout2022-08-26 14:40:06
cashout_time1969-12-31 23:59:59
total_payout_value11.668 HBD
curator_payout_value11.583 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,363
author_reputation104,701,778,605,493
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,855,807
net_rshares32,986,189,600,705
author_curate_reward""
vote details (302)
@curation-cartel ·
![1UP-PIZZA.png](https://files.peakd.com/file/peakd-hive/curation-cartel/23xediR4hotaNsS5pUJrmYVg3YGeTLpui41uCij2jhUDZ4uFT84zoGJf8a8VnfELXLJgt.png) |  <div class="phishy"><u><h4>You have received a __1UP__ from @dlmmqb!</h4></u></div> The @oneup-cartel will soon upvote you with:<hr> __@stem-curator, @neoxag-curator__ <hr>_And they will bring !PIZZA 🍕._
-|-

<sup>[Learn more](https://peakd.com/hive-102223/@flauwy/the-curation-cartel-1up-trigger-smart-voting-mana-and-high-delegation-returns-for-14-different-tribes) about our delegation service to earn daily rewards. Join the Cartel on [Discord](https://discord.gg/mvtAneE3Ca).</sup>
properties (22)
authorcuration-cartel
permlinkre-splash-screen-or-android-app-20220820t015227z
categoryhive-153850
json_metadata"{"app": "beem/0.24.26"}"
created2022-08-20 01:52:27
last_update2022-08-20 01:52:27
depth1
children0
last_payout2022-08-27 01:52:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length637
author_reputation1,123,882,653,763
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,870,594
net_rshares0
@dlmmqb ·
Congo pongo for being consistent with this learning series. !1UP

<div class=text-center> 
You can earn passive income by delegation of tribe tokens to "The Cartel".

Click this banner to join "The Cartel" discord server.

[![dlmmqb-TheCartel-banner](https://images.hive.blog/p/FUkUE5bzkAZT3HzV5tJDiU2ik81PCd4JCyhWnRcDN8XJsVFY3UNB8DCSmoM2ujRpecRrPXsPH9dFMuJKxLKfeZPBgLnZuUbnYbwhioLnFLQPnge8EMm1SCsLqC5EQSHEM7uy7Bso7uBpiM6je1T8qfEb8c4wuu3hF5XU?format=match&mode=fit)](https://discord.gg/zQrvxAu7mu) 
</div>

<center>**Release your inner Rock Star with [Rising Star](https://www.risingstargame.com?referrer=dlmmqb)! The best #play2earn game on Hive! 
[Play for Free](https://www.risingstargame.com?referrer=dlmmqb)!**</center>
👍  , , ,
properties (23)
authordlmmqb
permlinkre-faisalamin-rgw4zh
categoryhive-153850
json_metadata{"tags":["hive-153850"],"app":"peakd/2022.07.1"}
created2022-08-20 01:47:42
last_update2022-08-20 01:47:42
depth1
children0
last_payout2022-08-27 01:47:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length724
author_reputation307,993,272,028,643
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,870,500
net_rshares1,844,539,846
author_curate_reward""
vote details (4)
@ecency ·
**Yay!** 🤗<br>Your content has been **boosted with Ecency Points**, by @faisalamin. <br>Use Ecency daily to boost your growth on platform! <br><br><b>Support Ecency</b><br>[Vote for new Proposal](https://hivesigner.com/sign/update-proposal-votes?proposal_ids=%5B197%5D&approve=true)<br>[Delegate HP and earn more](https://ecency.com/hive-125125/@ecency/daily-100-curation-rewards)
properties (22)
authorecency
permlinkre-2022819t172247638z
categoryhive-153850
json_metadata{"tags":["ecency"],"app":"ecency/3.0.20-welcome","format":"markdown+html"}
created2022-08-19 17:22:48
last_update2022-08-19 17:22:48
depth1
children0
last_payout2022-08-26 17:22:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length380
author_reputation630,688,773,289,167
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,859,850
net_rshares0
@pizzabot ·
<center>PIZZA! 


PIZZA Holders sent <strong>$PIZZA</strong> tips in this post's comments:
@curation-cartel<sub>(4/20)</sub> tipped @faisalamin (x1)


<sub>Please <a href="https://vote.hive.uno/@pizza.witness">vote for pizza.witness</a>!</sub></center>
properties (22)
authorpizzabot
permlinkre-splash-screen-or-android-app-20220820t015348z
categoryhive-153850
json_metadata"{"app": "beem/0.24.26"}"
created2022-08-20 01:53:48
last_update2022-08-20 01:53:48
depth1
children0
last_payout2022-08-27 01:53:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length252
author_reputation7,696,788,179,095
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,870,608
net_rshares0
@stemsocial ·
re-faisalamin-splash-screen-or-android-app-20220819t213615900z
<div class='text-justify'> <div class='pull-left'>
 <img src='https://stem.openhive.network/images/stemsocialsupport7.png'> </div>

Thanks for your contribution to the <a href='/trending/hive-196387'>STEMsocial community</a>. Feel free to join us on <a href='https://discord.gg/9c7pKVD'>discord</a> to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.&nbsp;<br />&nbsp;<br />
</div>
properties (22)
authorstemsocial
permlinkre-faisalamin-splash-screen-or-android-app-20220819t213615900z
categoryhive-153850
json_metadata{"app":"STEMsocial"}
created2022-08-19 21:36:15
last_update2022-08-19 21:36:15
depth1
children0
last_payout2022-08-26 21:36:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length565
author_reputation22,930,655,615,829
root_title"Splash Screen | Android App Development | Lecture#49 | Hive Learners"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id115,866,230
net_rshares0