Android 防止启动页面(SplashActivity)被多次启动(笔记)
16lz
2021-01-23
话不多说直接上代码:
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(!isTaskRoot()){ Intent i=getIntent(); String action=i.getAction(); if(i.hasCategory(Intent.CATEGORY_APP_CALENDAR) && !TextUtils.isEmpty(action) && action.equals(Intent.ACTION_MAIN)){ finish(); return; } }
代码添加在super.onCreate(savedInstanceState); 与setContentView();之间。
更多相关文章
- android全屏代码
- android典型代码系列(四)------android全屏代码
- 代码设置android:icon,android:label
- Android 拖拽效果实现代码分享 - ORIETech
- android图片转换代码
- 一个android通信录的源代码
- 7个Android应用程序源代码
- 介绍本人的一个Android项目(附源代码)
- Android安卓51个开源代码