radityakurnianto

Splash2

Jun 7th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.52 KB | None | 0 0
  1. package com.otak3.goo;
  2.  
  3. import android.app.Activity;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.database.sqlite.SQLiteDatabase;
  7. import android.os.Bundle;
  8. import android.widget.ImageView;
  9.  
  10. public class Splash2 extends Activity {
  11.     private ImageView image;
  12.     private Thread mThread;
  13.     private SQLiteDatabase db = null;
  14.  
  15.     private SoalData SoalData = null;  
  16.     /** Called when the activity is first created. */
  17.     @Override
  18.    
  19.     public void onCreate(Bundle savedInstanceState) {
  20.     super.onCreate(savedInstanceState);
  21.     setContentView(R.layout.splash2);
  22.     image=(ImageView) findViewById(R.id.splashView);
  23.     SoalData = new SoalData(this);
  24.     db = SoalData.getWritableDatabase();
  25.     SoalData.createTable(db);
  26.     SoalData.generateData(db); 
  27.  
  28.  
  29.     final Context myContext=this;
  30.     image.setImageResource(R.drawable.logo4);
  31.  
  32.     mThread =  new Thread(){
  33.         @Override
  34.         public void run(){
  35.             try {
  36.                 synchronized(this){
  37.                     // Wait given period of time or exit on touch
  38.                     wait(5000);
  39.                 }
  40.             }
  41.             catch(InterruptedException ex){                    
  42.             }
  43.  
  44.             finish();
  45.            
  46.             // Run next activity
  47.             Intent intent = new Intent();
  48.             intent.setClass(myContext, UtamaActivity.class);
  49.             startActivity(intent);
  50.             stop();                    
  51.         }
  52.     };
  53.     mThread.start();
  54.     this.finish();
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment