Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.app.Activity; import android.os.Build; public class Main { /** * @see android.app.Activity#finishAfterTransition(). */ public static void finishAfterTransition(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activity.finishAfterTransition(); } else { activity.finish(); } } }