我想进行相同的活动,例如MainActivity-> MainActivity而不是MainActivity-> SecondActivity
她是我的代码,但它不起作用,它会停止我的应用程序,如何解决它
{
"name": "contract-vs-paye-calc-type-script",
"version": "0.0.0",
"description": "ContractVsPayeCalcTypeScript",
"scripts": {
"start": "node nodeserver.js",
"lint": "eslint src"
},
"main": "/src/App.js",
"author": {
"name": "MC",
"email": "admin@admin.com"
},
"dependencies": {
"babel-core": "^6.7.7",
"babel-loader": "^6.2.4",
"express": "3.4.4",
"jade": "*",
"react": "^15.0.1",
"react-dom": "^15.0.1",
"react-hot-loader": "^1.3.0",
"stylus": "*",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
},
"module": {
"loaders": [
{
"test": "/\\.ts(x?)$/",
"loader": "babel-loader!ts-loader"
}
]
}
}
答案 0 :(得分:7)
我想你想刷新我们的活动,试试这个
finish();
startActivity(getIntent());
或试试这个
Intent intent = getIntent();
finish();
startActivity(intent);
答案 1 :(得分:2)
尝试
Intent intent = new Intent(FriendDetailsActivity.this, FriendDetailsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
答案 2 :(得分:1)
您可以调用方法
recreate();