Android – an activity that completes another activity

What are the ways and how to complete some activities from the stack? I have a service that will look for updates. When an update is found, it will open the update activity, in which the installation prompt will be displayed. However, after the installation is completed, I want to complete the update activity, because it is not necessary to be still on the stack

thank you

resolvent:

If the update activity is starting another installation activity, you may want to override void onactivityresult (int requestcode, int resultcode, intent intent) in the update activity to provide the following implementation. In addition, when the update activity starts the installation activity, it should use startactivityforresult (intent, int) instead of startactivity (intent)

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

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>