Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package walk.me;
- import android.app.Activity;
- import android.content.Intent;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- public class Splasher extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- // TODO Auto-generated method stub
- super.onCreate(savedInstanceState);
- setContentView(R.layout.splash);
- new SplashOperation().execute("");
- }
- @Override
- protected void onPause() {
- // TODO Auto-generated method stub
- super.onPause();
- }
- @Override
- protected void onResume() {
- // TODO Auto-generated method stub
- super.onResume();
- }
- private class SplashOperation extends AsyncTask<String, Void, String> {
- public LinearLayout layout= (LinearLayout)findViewById(R.id.splash);
- public int imgSplash[]=
- {R.drawable.a1,R.drawable.a2,R.drawable.a3, R.drawable.a4,
- R.drawable.a5,R.drawable.a6,R.drawable.a7,R.drawable.a8,R.drawable.a9,
- R.drawable.a10,R.drawable.a11,R.drawable.a12};
- public int timer=0;
- @Override
- protected String doInBackground(String... params) {
- Thread splashThread = new Thread()
- {
- public void run()
- {
- int timer=0;
- try
- {
- while(timer <= 2000)
- {
- sleep(200);
- timer = timer + 1000;
- }
- startActivity(new Intent("walk.me.CLEARSCREEN"));
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- finally
- {
- finish();
- }
- }
- };
- splashThread.start();
- return null;
- }
- @Override
- protected void onPostExecute(String result) {
- }
- @Override
- protected void onPreExecute() {
- @Override
- protected void onProgressUpdate(Void... values) {
- new Runnable(){
- @Override
- public void run() {
- layout.setBackgroundResource(imgSplash[timer]);
- layout.invalidate();
- }
- }.run();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement