Android: Redirect to another Activity after delay

Viewed 6560

So I am developing a simple app for a college project, And I have been able to integrate a Facebook login using fragments.

But I now am stuck trying to redirect the user after they login. I simply want to redirect them to the second activity page

Here is my code for the Facebook login success

private FacebookCallback<LoginResult> mCallback=new FacebookCallback<LoginResult>() {
    @Override
    public void onSuccess(LoginResult loginResult) {
        AccessToken accessToken = loginResult.getAccessToken();
        Profile profile = Profile.getCurrentProfile();
        if (profile != null) {
            display.setText("Welcome: " + profile.getFirstName());
            //Redirect to Second Activity

        }

} 
5 Answers

In Kotlin;

  val r = Runnable {

        startActivity(Intent(this, AuthorActivity::class.java))
    }
    val h = Handler()

    h.postDelayed(r, 10) 
Related