0

How is it possible to create a splash screen for android auto to display it on a head unit of a car? I wish it would be a logo of a company or user greeting in full screen. By the ideal it could be with some animation. So how can I deal with splash screen implementation for android auto?

1 Answers1

0

please follow the steps

public class SplashScreenActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_splash_screen);
       new Handler().postDelayed(new Runnable() {
           @Override
           public void run() {
            //This method will be executed once the timer is over
            // Start your app main activity
           Intent i = new Intent(SplashScreenActivity.this, MainActivity.class);
           startActivity(i);
            // close this activity
           finish();
           }
        }, 3000);
    }
}

Create Background for Splash Screen in drawable/splash_background.xml, the bitmap is the image we want to show.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="<http://schemas.android.com/apk/res/android>">
    <item
        android:drawable="@drawable/bg_gradient"/>
    <item>
        <bitmap android:gravity="center"
            android:src="@drawable/splash_fg"/>
    </item>
</layer-list>

Create the gradient onto which your app logo will be placed in drawable/bg_gradient.xml, background can be a gradient or any colour depending on your app.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="<http://schemas.android.com/apk/res/android>"
    android:shape="rectangle" >
    <gradient
        android:type="linear"
        android:angle="135"
        android:startColor="#ff1b49"
        android:endColor="#e67d20" />
</shape>

Setting the Intent to your MainActivity.java from SplashScreenActivity.java

public class SplashScreenActivity extends AppCompatActivity {
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
        finish();
    }
}
Mahesh
  • 862
  • 5
  • 11
  • Android Auto does not have such things like activities or layout files, so I'm afraid this approach is not answering the question above. – Sarah Multitasker May 25 '23 at 08:43