creating an app which showing splash screen 45sec after then movite acitivity

creating an app which showing splash screen 45sec after then movite acitivity

I'd be glad to help you create code for an Android app that displays a splash screen for 45 seconds before transitioning to the main activity. Here's a breakdown using Kotlin, which is the recommended language for modern Android development:

write java code shown in image in mainacititi.java
creating  an app which showing splash screen 45sec after then movite acitivity


Create a new layout resource file named activity_splash_screen.xml and design your splash screen UI using XML. You can add an image, text, or any other elements you want to display during the splash screen duration.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/splash_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/your_splash_image" />  <TextView
        android:id="@+id/app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/splash_image"
        android:layout_centerHorizontal="true"
        android:text="@string/app_name"
        android:textSize="24sp"
        android:textStyle="bold" />

</RelativeLayout>

3. Update Android Manifest:

  • In your AndroidManifest.xml file, set the android:screenOrientation attribute of the SplashScreenActivity to portrait or landscape to control the splash screen orientation if needed.
  • Optionally, you can also set the android:theme attribute to a custom theme for the splash screen if you want to apply different styles compared to your main activity.
  • <manifest ... >

  •     <application ... >

  •         <activity
  •             android:name=".SplashScreenActivity"
  •             android:screenOrientation="portrait">  <intent-filter>
  •                 <action android:name="android.intent.action.MAIN" />
  •                 <category android:name="android.intent.category.LAUNCHER" />
  •             </intent-filter>
  •         </activity>

  •         </application>

  • </manifest>




Post a Comment

Previous Post Next Post