Reloading an activity in Android
来源:互联网 发布:石油大学华东网络教育 编辑:程序博客网 时间:2024/05/20 09:26
More often i wanted to reload an activity to refresh the contents of an page. I have seen many ways to do this in Android world and i always puzzled about the best approach.
However these are some of the approaches that i took . I found the following two approaches a lot cleaner as they kill the existing intent and restart.
Approach 1:
Intent intent = getIntent();finish();startActivity(intent);
Approach 2:
</pre><pre name="code" class="java">Intent intent = getIntent();overridePendingTransition(0, 0);intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);finish();overridePendingTransition(0, 0);startActivity(intent);
0 0
- Reloading an activity in Android
- Reloading an ActiveX control error
- 3 Ways to Kill an Application/Activity/Process in Android
- android-Recreating an Activity
- Android Activity生命周期 之starting an activity
- Activity Lifecycle in Android
- Android: Capturing the return of an activity
- android Training Stopping and Restarting an Activity
- what is Activity in Android
- integrate opencv manager in an android app
- Building an AAR Library in Android Studio
- Android training 管理Activity生命周期之启动Activity(Starting an Activity)
- Android training 管理Activity生命周期之暂停/恢复Activity(Pausing and Resuming an Activity)
- hot-reloading
- hot-reloading
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- Android之Starting an Activity for a Result例子简介
- android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity
- zsh安装和插件安装总结
- 二分图带权最大独立集
- Android MediaExtractor 浅析
- 最简单的点击展开关闭效果
- 小说情感分析器(基于词典)
- Reloading an activity in Android
- Eclipse 的git相关配置
- Leetcode: Distinct Subsequences
- java 读写锁 , 官方自带示例读解,ReentrantReadWriteLock
- 什么是B2B、B2C、C2C?
- Hadoop短期学习笔记----阿冬专栏
- File杂谈——初识file控件
- Javascript操作Cookie
- Processing 教程(1) - 基本绘图、变量、随机变量