在android中重新加载一次活动只有一次

在android中重新加载一次活动只有一次

本文介绍了在android中重新加载一次活动只有一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好,我需要在活动`oncreate()`方法完成时刷新/重新加载当前活动一次,我该如何实现该过程?解决方案 尝试 finish(); startActivity(getIntent()); 从意图开始您的同一活动并关闭活动。 Intent refresh = new Intent( this ,Main。类); startActivity(refresh); // 启动相同的活动 完成() ; // 完成活动。 Hi Friends,I need to refresh/reload the current activity only once when the activity `oncreate()` method completes,how can i implement that process? 解决方案 tryfinish();startActivity(getIntent());Start with an intent your same activity and close the activity.Intent refresh = new Intent(this, Main.class);startActivity(refresh);//Start the same Activityfinish(); //finish Activity. 这篇关于在android中重新加载一次活动只有一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-06 17:17