[英]Restart android app after cache clear
我在安装Android应用程序的更新后使用clearApplicationUserData()
来清除应用程序缓存。 一旦上述方法运行,app立即关闭。 关闭应用程序本身后重启应用程序的任何建议?
if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT) {
((ActivityManager)SplashScreenActivity.this.getSystemService(ACTIVITY_SERVICE))
.clearApplicationUserData();
Toast.makeText(getApplicationContext(), "Cache cleared", Toast.LENGTH_LONG).show();
}
好吧,看看这个解决方案 ,似乎有适当的方法来做到这一点。 是通过在startActivity中添加以下代码
intent = PendingIntent.getActivity(YourApplication.getInstance().getBaseContext(), 0,
new Intent(getIntent()), getIntent().getFlags());
尝试这个:
@Override
public void onStop(){
recreate();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.