0% found this document useful (0 votes)
3 views

tutorial SplashScreen app

The document outlines the addition of a splash screen for an Android application, including the XML layout file (Splash.xml) that displays a welcome message, and the Java class (Splash.java) that manages the splash screen's timing before transitioning to the MainActivity. It also includes modifications to the Android Manifest file to define the splash activity as the main entry point of the application. Overall, it sets up a simple splash screen functionality within the app.

Uploaded by

paulinho.landes
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

tutorial SplashScreen app

The document outlines the addition of a splash screen for an Android application, including the XML layout file (Splash.xml) that displays a welcome message, and the Java class (Splash.java) that manages the splash screen's timing before transitioning to the MainActivity. It also includes modifications to the Android Manifest file to define the splash activity as the main entry point of the application. Overall, it sets up a simple splash screen functionality within the app.

Uploaded by

paulinho.landes
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

############################

•Add new xml:Splash.xml


############################

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">

<TextView
android:text="Welcome to my app"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

############################
•Add new java: Splash.java
############################

package com.kc.splashscreen;
import android.app.*;
import android.os.*;
import java.util.*;
import android.content.*;
public class splash extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);

Timer time=new Timer();


time.schedule(new TimerTask(){
@Override
public void run()
{
// TODO: Implement this method
Intent in=new Intent(splash.this,MainActivity.class);
startActivity(in);
finish();
}},3000);}}

############################
•Android Manifest.xml
############################

<?xml version="1.0" encoding="utf-8"?>


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kc.splashscreen" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
<activity
android:name=".MainActivity"/>
</application>
</manifest>

You might also like