大牛专栏 收藏本版 已有21人收藏 +发表新主题
查看: 13387|回复: 1
打印 上一主题 下一主题

Capricorn|Unity3d android界面跳转到unity界面,为何会finish两个ac...

[复制链接]

Capricorn|Unity3d android界面跳转到unity界面,为何会finish两个ac...

zzlple 发表于 2016-7-9 00:57:46 浏览:  13387 回复:  1 只看该作者 复制链接
  public void quit()
  {
    this.q = true;
    if (!this.i.e())
      pause();
    this.a.a();
    try
    {
      this.a.join(4000L);
    }
    catch (InterruptedException localInterruptedException)
    {
      this.a.interrupt();
    }
    if (this.k != null)
      this.m.unregisterReceiver(this.k);
    this.k = null;
    if (v.c())
      removeAllViews();
    if (q.e)
      q.l.a(this.m);
    if (q.d)
      q.k.a();
    kill();
    h();
  }
我们看源码可以知道由于unity调用了

  protected void kill()
  {


/**
* Kill the process with the given PID.
* Note that, though this API allows us to request to
* kill any process based on its PID, the kernel will
* still impose standard restrictions on which PIDs you
* are actually able to kill.  Typically this means only
* the process running the caller's packages/application
* and any additional processes created by that app; packages
* sharing a common UID will also be able to kill each
* other's processes.
*/    Process.killProcess(Process.myPid());
  }

所以会导致连续结束两个activity的原因,那我们就可以复写调用activity的finish方法,不去调用父类就不会导致一次会finish两次

分享至:
| 人收藏
回复

使用道具 举报

该用户从未签到

沙发
tony2008cn_15 发表于 2016-7-9 15:00:56 只看该作者
太棒了,感谢楼主分享
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中级会员

Copyright © 2013-2017 ARinChina-增强现实中国技术论坛   All Rights Reserved.