How to create a SplashScreen Facebook Login Activity in Android

I want to upload code here but I promise you, it's a mess and you do not want to see it. I've been trying to somewhat follow the Facebook 3.6 Samples and use their API but it is so much more complicated than the previous version.

Has anybody accomplished this? Could anybody point me in the right direction?

Answers


Here I included the code which i had done in my project. Please check this out. It may help you.

Animation animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.fade_in);
Animation animationFadeOut = AnimationUtils.loadAnimation(this, R.anim.fade_out);

                handler = new Handle(this);

        animator = new Thread() {
            public void run() {
                try {
                    handler.sendMessage(handler.obtainMessage(1));
                    sleep(2000);
                    handler.sendMessage(handler.obtainMessage(2));
                    sleep(2000);
                    handler.sendMessage(handler.obtainMessage(3));
                    sleep(2000);
                    handler.sendMessage(handler.obtainMessage(4));

                } catch (Exception e) {
                    e.printStackTrace();

                }
            }
        };

        animator.start();

static class Handle extends Handler {
        private final WeakReference<SplashActivity> mSplash;

        Handle(SplashActivity splash) {
                        // weakReference is used for avoiding memory leak
            mSplash = new WeakReference<SplashActivity>(splash);
        }

        @Override
        public void handleMessage(Message msg) {
            // TODO Auto-generated method stub
            SplashActivity splash = mSplash.get();
            if (msg.what == 1 && splash.isRunning == true) {
                splash.iv.startAnimation(splash.animationFadeIn);
            } else if (msg.what == 2 && splash.isRunning == true) {
            } else if (msg.what == 3 && splash.isRunning == true) {
                splash.iv.startAnimation(splash.animationFadeOut);
            } else if (msg.what == 4 && splash.isRunning == true) {
                splash.iv.setImageResource(android.R.color.black);
                Intent i = new Intent(splash, MainActivity.class);              
                splash.overridePendingTransition(0, 0);
                splash.startActivity(i);
                splash.finish();
            }
            super.handleMessage(msg);

        }

    }

Check this example:

public class SplashActivity extends Activity {
    private long splashDelay = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        // Remove title bar
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        // Remove notification bar
        /*
         * this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
         * WindowManager.LayoutParams.FLAG_FULLSCREEN);
        */

        setContentView(R.layout.activity_splash);

        TimerTask task = new TimerTask() {

            @Override
            public void run() {
                finish();
                startActivity(new Intent().setClass(SplashActivity.this,
                        MainActivity.class));
                overridePendingTransition(R.anim.fade, R.anim.hold);
            }
        };

        Timer timer = new Timer();
        timer.schedule(task, splashDelay);
    }
}

Source: Android Activity Splash Screen


refer here for facebook splash UI: Facebook's splash screen


Need Your Help

How to run python file from windows?

python-2.7

i have installed following packages to my windows machine -

How should sonar be configured to work with StyleCop 4.7

c# sonarqube stylecop static-code-analysis

I am attempting to get sonar to work with StyleCop 4.7 and am having a few issues.