我有活动A,B,C,D。在一项活动中,我列出了一些数据。我称他们为A-> B-> C-> D,当我点击D活动上的确认按钮时,我必须转到A.我使用此代码:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php?\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php?$ http://www.website.com/$1 [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^website\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.website\.com$
RewriteRule ^(.*)$ https://www.website.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
当活动A调用时,我的列表为空。我尝试使用onSavedInstanceState,但它也是null。 我怎么能这样做?
答案 0 :(得分:1)
**Solution 1.**
Intent intent = new Intent(D.this,A.class);
startActivity(intent);
finishAffinity();
Here "finishAffinity" will close all the activity and will create activity A.
**Solution 2.**
Intent intent = new Intent(D.this,A.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("reloadHome", true);
startActivity(intent);
finish();
Check value on A activity to override "onNewIntent"
If you will pass any value from activity D to A you can get that data into "onNewIntent" method. in this scenario.
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
}
答案 1 :(得分:0)
这是因为A Activity
正在重新创建。你可以通过不同的方式来做到这一点:
在finish()
的D - >上调用Activity
方法C - > B,然后Activity
弹出一个。
将列表从Activity
A传递给B - > C - > D,然后再次传递到Activity
A.
希望它有所帮助!