首页 > 网站 > 建站经验 > 正文

Android重启运用程序 的代码

2019-11-02 15:08:29
字体:
来源:转载
供稿:网友

   在开发中需要重新启动运用程序,网上找了下,找到一段重启的代码,经试验发现代码有效,现将代码记录如下:

  Intent i = getBaseContext()

历史名人[www.9-39.com/html/person/]
.getPackageManager()

  .getLaunchIntentForPackage(getBaseContext().getPackageName());

  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

  startActivity(i);

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表