Don't want to refresh tabsactivity when call from activity android

让人想犯罪 __ 提交于 2019-12-24 17:24:29

问题


I am trying to stop refreshing my tabs activity, in the below pictures, you can see when I start new activity from tab fragment and then close it by pressing back button and returning to the tabs activity, all tabs will be restarted. I need to somehow resume tabs activity,

In the codes below, I call new activity:

Intent i = new Intent(context, New_Activity.class);
startActivity(i); 

and close it in this way:

finish();


回答1:


Instead of finish just use flag for it like this way

Intent intent = new Intent(current_context, destination_activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
startActivity(intent);


来源:https://stackoverflow.com/questions/33053015/dont-want-to-refresh-tabsactivity-when-call-from-activity-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!