Example usage for android.app Activity isDestroyed

List of usage examples for android.app Activity isDestroyed

Introduction

In this page you can find the example usage for android.app Activity isDestroyed.

Prototype

public boolean isDestroyed() 

Source Link

Document

Returns true if the final #onDestroy() call has been made on the Activity, so this instance is now dead.

Usage

From source file:Main.java

public static boolean isActivityLive(Activity activity) {
    return activity != null && !activity.isDestroyed() && !activity.isFinishing();
}

From source file:Main.java

public static boolean activityIsLiving(Activity activity) {
    if (activity == null || activity.isFinishing() || activity.isDestroyed()) {
        return false;
    } else {//from w ww.j  a  v a2  s .  com
        return true;
    }
}

From source file:Main.java

public static boolean isAlive(Activity activity) {
    return activity != null
            && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())
            && !activity.isFinishing();
}

From source file:Main.java

public static boolean isActivyFinish(Context context) {
    // TODO Auto-generated method stub
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        if (activity.isFinishing()) {
            return true;
        }//from w  ww.  j  a  va  2  s .c  om
        if (VERSION.SDK_INT >= VERSION_CODES.KITKAT && activity.isDestroyed()) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static boolean isActivityValid(Activity activity) {
    if (activity == null) {
        return false;
    } else {/*from  ww w. ja v  a  2s  .c o  m*/
        if (Build.VERSION.SDK_INT >= 17) {
            return !activity.isFinishing() && !activity.isDestroyed();
        } else {
            return !activity.isFinishing();
        }
    }
}

From source file:Main.java

@SuppressLint("NewApi")
public static boolean isActivityValid(@Nullable final Activity activity) {
    if (activity == null) {
        return false;
    } else {//w w w.  j a va  2  s .c o m
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return !activity.isFinishing() && !activity.isDestroyed();
        } else {
            return !activity.isFinishing();
        }
    }
}

From source file:com.idlab.idcorp.assignment_android.common.utils.PermissionUtil.java

public static boolean checkAndRequestPermission(Activity activity, int permissionRequestCode,
        String... permissions) {//from w  ww. ja  v  a2  s  .co m
    String[] requiredPermissions = getRequiredPermissions(activity, permissions);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        if (requiredPermissions.length > 0 && !activity.isDestroyed()) {
            ActivityCompat.requestPermissions(activity, requiredPermissions, permissionRequestCode);
            return false;
        } else {
            return true;
        }
    } else {
        if (requiredPermissions.length > 0) {
            ActivityCompat.requestPermissions(activity, requiredPermissions, permissionRequestCode);
            return false;
        } else {
            return true;
        }
    }
}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void killAllFragments(Activity app) {
    if (app != null && !app.isDestroyed())
        app.getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void startBreadActivity(Activity from, boolean auth) {
    if (from == null)
        return;/*from   w  w  w . j a  v  a 2  s.c  o  m*/
    Log.e(TAG, "startBreadActivity: " + from.getClass().getName());
    Class toStart = auth ? LoginActivity.class : BreadActivity.class;
    Intent intent = new Intent(from, toStart);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    from.startActivity(intent);
    from.overridePendingTransition(R.anim.fade_up, R.anim.fade_down);
    if (!from.isDestroyed()) {
        from.finish();
    }
}

From source file:org.uoyabause.android.tv.CardPresenter.java

@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
    GameInfo game = (GameInfo) item;/*from   w w  w  . j  a  v a2  s  .  c  o m*/
    ImageCardView cardView = (ImageCardView) viewHolder.view;
    cardView.setTitleText(game.game_title);
    String rate = "";
    for (int i = 0; i < game.rating; i++) {
        rate += "";
    }
    if (game.device_infomation.equals("CD-1/1")) {

    } else {
        rate += " " + game.device_infomation;
    }

    cardView.setContentText(rate);
    cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
    Activity activity = (Activity) viewHolder.view.getContext();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) {
        return;
    }
    if (!game.image_url.equals("")) {
        Glide.with(viewHolder.view.getContext()).load(game.image_url).centerCrop().error(mDefaultCardImage)
                .into(cardView.getMainImageView());
    } else {

    }
}