Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.delhendro.aplikasipertama;
- import com.delhendro.aplikasipertama.Task.TaskFinishedListener;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.widget.ProgressBar;
- public class splash extends Activity implements TaskFinishedListener {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // Show the splashbe screen
- setContentView(R.layout.splash);
- // Find the progress bar
- ProgressBar progressBar = (ProgressBar) findViewById(R.id.activity_splash_progress_bar);
- // Start your loading
- 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
- }
- // This is the callback for when your async task has finished
- @Override
- public void onTaskFinished() {
- completeSplash();
- }
- private void completeSplash(){
- startApp();
- finish(); // Don't forget to finish this Splash Activity so the user can't return to it!
- }
- private void startApp() {
- Intent intent = new Intent(splash.this, MainActivity.class);
- startActivity(intent);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment