Android Open Source - ROBO-PUSET Splash






From Project

Back to project page ROBO-PUSET.

License

The source code is released under:

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...

If you think the Android project ROBO-PUSET listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mi5t4n.remotecontrol;
//  w  w w . j a v  a2  s. c  om
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

public class Splash extends Activity implements OnClickListener{
  MediaPlayer splashMusic;
  LinearLayout llSplash;
  Thread timer;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    llSplash = (LinearLayout) findViewById(R.id.llSplash);
    llSplash.setOnClickListener(this);

    splashMusic = MediaPlayer.create(Splash.this, R.raw.splash);
    splashMusic.start();

    timer = new Thread() {
      public void run() {
        try {
          sleep(5000);
        } catch (InterruptedException e) {
          e.printStackTrace();
        } finally {
          Intent i = new Intent("android.intent.action.MAINACTIVITY");
          startActivity(i);
        }
      }
    };
    timer.start();
  }

  @Override
  protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    splashMusic.release();
    finish();
  }

  @Override
  public void onClick(View arg0) {
    // TODO Auto-generated method stub
    switch (arg0.getId()) {
    case R.id.llSplash:
      timer.interrupt();
      timer=null;
      Intent i = new Intent("android.intent.action.MAINACTIVITY");
      startActivity(i);
    }
  }
}




Java Source Code List

com.mi5t4n.remotecontrol.BluetoothDevices.java
com.mi5t4n.remotecontrol.MainActivity.java
com.mi5t4n.remotecontrol.Splash.java