delhendro

Untitled

May 6th, 2016
4,156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package com.delhendro.aplikasipertama;
  2.  
  3. import com.delhendro.aplikasipertama.Task.TaskFinishedListener;
  4. import android.app.Activity;
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.widget.ProgressBar;
  8.  
  9. public class splash extends Activity implements TaskFinishedListener {
  10.  
  11. @Override
  12. public void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. // Show the splashbe screen
  15. setContentView(R.layout.splash);
  16. // Find the progress bar
  17. ProgressBar progressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
  18. // Start your loading
  19. new Task(progressBar, this).execute("www.delhendro.com"); // Pass in whatever you need a url is just an example we don't use it in this tutorial
  20. }
  21.  
  22. // This is the callback for when your async task has finished
  23. @Override
  24. public void onTaskFinished() {
  25. completeSplash();
  26. }
  27.  
  28. private void completeSplash(){
  29. startApp();
  30. finish(); // Don't forget to finish this Splash Activity so the user can't return to it!
  31. }
  32.  
  33. private void startApp() {
  34. Intent intent = new Intent(splash.this, MainActivity.class);
  35. startActivity(intent);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment