start Activity With Shared Element - Android Activity

Android examples for Activity:Activity Start

Description

start Activity With Shared Element

Demo Code


//package com.java2s;
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());
    }//from ww  w  .j a  v  a2  s  . com
}

Related Tutorials