start Activity With Shared Element - Android android.app

Android examples for android.app:Activity Start

Description

start Activity With Shared Element

Demo Code

import android.app.Activity;
import android.content.Intent;
import android.support.annotation.StringRes;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ActivityOptionsCompat;
import android.view.View;

public class Main{

    public static void startActivityWithSharedElement(Activity activity,
            Intent intent, View srcView, @StringRes int id) {
        final String transitionName = activity.getString(id);
        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, srcView,
                        transitionName);
        ActivityCompat.startActivity(activity, intent, options.toBundle());
    }// w  w  w.ja  v a 2 s  .c  o m

}

Related Tutorials