Android的 - 从另一个活动整理活动 [英] Android - finishing activity from another activity

查看:116
本文介绍了Android的 - 从另一个活动整理活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法,如何从一堆完成一定的活动?我的服务,这看起来更新,当发现更新,它会打开更新活动,其中提示进行安装会出现。但安装后出现我要完成更新活动,因为它没有必要仍然是对一个堆栈。

is there any way, how to finish certain activity from a stack? I have service, which looks for updates, and when update is found, it opens update activity, where prompt for installation will appears. But after the installation appears I want to finish update activity, because it is not necessary to still be on a stack.

感谢

推荐答案

如果更新活动启动另一个安装活动,那么你可能要重写无效onActivityResult(INT申请code,INT因此code,意图意图)的更新活动,并提供以下实施。此外,当更新活动启动安装活动,就应该这样做与 startActivityForResult(意图,INT),无法与 startActivity(意向)

If the update activity is launching another installation activity, then you may want to override void onActivityResult(int requestCode, int resultCode, Intent intent) in the update activity, providing the following implementation. Also, when the update activity launches the installation activity, it should do so with startActivityForResult(Intent, int), not with startActivity(Intent).

  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent)
  {
    super.onActivityResult(requestCode, resultCode, intent);
    finish();
  }

这篇关于Android的 - 从另一个活动整理活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆