How to create a splash screen in android studio.

Android Studio में Calendar App के लिए Hindi भाषा में Splash Screen कैसे बनाएं।

इस ब्लॉग में हम जानने वाले हैं कि कैलेंडर ऐप के लिए स्प्लैश स्क्रीन कैसे बनाते हैं, ताकि जब भी कोई यूजर कैलेंडर ऐप को खोले तो सबसे पहले उसे स्प्लैश स्क्रीन दिखाई दे उसके बाद ही वह अगली गतिविधि पर जा सके।

In this blog, we are going to learn how to make a splash screen for the calendar app, so that whenever a user opens the calendar app, first of all, he can see the splash screen only after that he can go to the next activity.

इस ब्लॉग में ये देखने वाले हैं की कैसे कलर को चेंज करने वाला कलर कोड निचे दिया गया है और साथ ही आपको YouTube का वीडियो लिंक भी दिया हुआ है जिससे आपको मॉडिफिकेशन करने में आपको कोई भी तरह की दिक्कत नहीं हो इसीलिए आपको निचे में वीडियो का लिंक दिया हुआ है

In this blog, they are going to see how the color code that changes the color is given below and also you have been given the video link of YouTube, so that you do not have any problem in doing the modification, that is why you will see the video below. link is given

ये है कलर कोड: Here is the color code:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="purple_200">#0e1111</color>
    <color name="purple_500">#0e1111</color>
    <color name="purple_700">#0e1111</color>
    <color name="teal_200">#232b2b</color>
    <color name="teal_700">#232b2b</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFDFA</color>
    <color name="ghost_white">#FAFCFF</color>
    <color name="blue">#0189C7</color>
</resources>

अब आपको activity_main.xml में आपको constraint layout के under आपको कुछ कोड को कॉपी पेस्ट करना है।

Now you have to copy and paste some code under the constraint layout in activity_main.xml

android:background="@color/purple_200"
android:fitsSystemWindows="true"

अब आपको एक लोगो चाहिए आपके अप्प के लिए तो अगर आप बनाये हो अपना लोगो तो अप्प खुद का लोगो उसे कीजिये बाकी अगर आपके पास लोगो नहीं है तो अप्प यंहा से डाउनलोड बटन पर क्लिक करके download कर सकतें हैं और इसे उसे कर सकते हो ये आपके लिए बिलकुल फ्री है लेकिन जब यह अप्प playstore पर अपलोड करने से पहले इस लोगो को चेंज कर लीजियेगा आपके लिए बेहतर रहेगा। अगर आपका अपना logo रहेगा तो अपना brand बनता है है इसीलिए चेंज करने के लिए बोल रहा हूँ।

Now you need a logo for your app, so if you have made your logo, then do your logo, else if you do not have a logo, then you can download it by clicking on the download button from here and you can do this It is free for you but when you change this logo before uploading this app on play store, it will be better for you. If you have your logo, then your brand is created, that’s why I am asking to change it.

Logo download होने के बाद आपको logo को drawable folder के undar कॉपी करके पेस्ट कर दीजिये उसके बाद निचे दिया दिया हुआ code को कॉपी एंड पेस्ट कर लीजिये।

After downloading the logo, copy and paste the logo under the drawable folder, after that copy and paste the code given below

<ImageView
    android:id="@+id/logo"
    android:layout_width="250dp"
    android:layout_height="250dp"
    android:contentDescription="@string/app_name"
    android:elevation="4dp"
    android:src="@drawable/icon"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.25" />

उसके बाद आपको एक TextView लेना है जिससे आपको app का version कितना है ये उसेर्स को दिखा सकतें है जिससे आपके users latest version का app use कर सके।

After that you have to take a TextView so that you can show the version of the app to the users so that your users can use the latest version of the app.

<string name="version">Version - 1.1.0</string>
<TextView
    android:id="@+id/version"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="sans-serif-medium"
    android:text="@string/version"
    android:textColor="@color/blue"
    android:textSize="24sp"
    android:textStyle="bold"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/logo"
    app:layout_constraintVertical_bias="0.1" />

अब हम progress bar को add करने वाले हैं उससे पहले आपको LottieFile का dependaency add करना होगा अपने project के gradle file के under जो dependency niche दिया हुआ है।

Now before we are going to add the progress bar, you have to add the dependency of LottieFile under the gradle file of your project which is given as a dependency niche.

implementation "com.airbnb.android:lottie:6.0.0"

उसके बाद आपको progressbar के लिए आपको json फाइल की जरुरत है जिससे आपकी progress bar चल सके इसीलिए आपको नीचे progress bar का json file दिया हुआ है जिससे आप सिर्फ download करके अपने project में use कर सकतें हैं।

After that you need json file for progress bar so that your progress bar can run, that’s why you have been given json file of progress bar below which you can just download and use in your project.

progress bar को download करने के बाद आपको res folder पर right click करके आपको एक नई Android Resource Directory को click करके आपको Resource Type में raw select करके OK बटन पर क्लिक कर देना हैं।

After downloading the progress bar, you have to click on a new Android Resource Directory by right-clicking on the res folder and selecting raw in the Resource Type, and clicking on the OK button.

raw folder बनने के बाद आपको जो मैंने json फाइल provide किया था उसको उस folder के ऊपर right click करके पेस्ट कर देना है जिससे आपको progress bar का json file आपको मिल जायेगा।

After the raw folder is created, you have to paste the json file that I provided by right-clicking on that folder, so that you will get the json file of the progress bar.

उसके बाद आपको LottiFile का xml code आपको जो नीचे मिला हुआ है उसके copy करके पेस्ट कर देना है version code के नीचे पेस्ट करना है।

After that, you have to copy and paste the XML code of LottiFile which is found below and paste it below the version code.

<com.airbnb.lottie.LottieAnimationView
    android:id="@+id/progressBar"
    android:layout_width="match_parent"
    android:layout_height="90dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/version"
    app:layout_constraintVertical_bias="0.5"
    app:lottie_autoPlay="true"
    app:lottie_loop="true"
    app:lottie_rawRes="@raw/progress_bar" />

अब आपको नीचे में developer का details देना है means इस app को किसने बनाया है यंहा आप अपना नाम दे सकतें हैं जिससे की आपकी ब्रांड बन सके इसीलिए हमने TextView का उसे किया है इसमें हमने string का use किया गया है तो आपको पहला string code को कॉपी करके strings फाइल में जा के पेस्ट कर देना उसके बाद ही आप TextView XML code को पेस्ट करना है।

Now you have to give the details of the developer below means who has created this app, here you can give your name so that your brand can be created, that is why we have used TextView, in this, we have used string, then you have to enter the first string code. Copy and paste it in the strings file only after that do you have to paste the TextView XML code.

<string name="developer">Developed By: <b>CLICK2CODE</b></string>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="1dp"
    android:text="@string/developer"
    android:textColor="@color/blue"
    android:textSize="12sp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/progressBar"
    app:layout_constraintVertical_bias="1" />

यहां से अब XML कोड से end हो गया है अब JAVA code का Entry स्टार्ट हो गया है

From here now the XML code has ended, and now the entry of the JAVA code has started.

अब आपको JAVA code के तरफ move करना है बूत उससे पहले आपको एक HomeActivity java फाइल बनाना पड़ेगा उसके बाद आपको “anim” फोल्डर बनाना पड़ेगा और उसके अंदर आपको “anim01” नाम का फाइल बनाकर उस file के अंदर आपको animation का code पेस्ट कर देना होगा. जो नीचे दिया हुआ है।

Now you have to move towards JAVA code but before that, you have to create a HomeActivity java file, after that, you have to create an “anim” folder and inside that, you have to create a file named “anim01” and paste the animation code inside that file. which is given below.

<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromAlpha="0.0"
    android:toAlpha="1.0"
    android:duration="1800">

</alpha>

उसके बाद आपको HomeActivity के JAVA file को ओपन करना है और उसके अंदर अब कोड को कॉपी एंड paste करना है।

After that, you have to open the JAVA file of HomeActivity and copy and paste the code inside it.

अब हम सबसे पहले id find करेंगे onCreate method के अंदर और उसके बाद Handler का Use करेंगे और उसके बाद animation लगाया जायेगा सभी files पर जो हमने इस splash screen के layout में use किया है।

Now we will first find the id inside the onCreate method and then use Handler and after that animation will be applied to all the files which we have used in the layout of this splash screen.

ImageView logo = findViewById(R.id.logo);
TextView version = findViewById(R.id.version);
LottieAnimationView progressBar = findViewById(R.id.progressBar);
int splashTimeOut = 3400;
new Handler().postDelayed(() -> {
    Intent intent = new Intent(MainActivity.this, HomeActivity.class);
    startActivity(intent);
    finish();
}, splashTimeOut);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim01);
logo.startAnimation(animation);
version.startAnimation(animation);
progressBar.startAnimation(animation);

नीचे में splash screen का view दिखाया गया है जिससे आपको समझने में आसानी होगा।

The splash screen view is shown below, which will make it easier for you to understand.

::: Thanks :::

Post Related Videos

Related Post

× Chat Now