Issue: https://code.google.com/p/android/issues/detail?id=169768
问题摘要:
===============================================================
1)The app starts with Activity A, which simply shows a button called "Launch B". 2)Press this button -- this executes startActivity(FLAG_ACTIVITY_REORDER_TO_FRONT, ActivityB.class). 3)Activity B becomes active, which do some UI and backhand loading operation on UI thread. 4)After pressing back from Activity B, OnBackPressed Of Activity B, this executes startActivity(FLAG_ACTIVITY_REORDER_TO_FRONT, ActivityA.class). 5)Activity A's onResume() is called as expected and everything looks fine (I can see Activity A content again). 6)Press the device's Back key and App freezes for around 10 seconds or more and comes out of application. Without calling onPause(), onDestroy(). (So it may be anr with certain logs) 7)Sometime or may be repeating same above step for 4-5 times it also unfortunately force close googlequicksearchbox
After looking at system logs: found some important logs:
E/ActivityManager( 958): Reason: Input dispatching timed out (Waiting because no window has focus but there is a focused application that may eventually add a window when it finishes starting up.)
===============================================================
解决方式(workaround):
在FLAG_ACTIVITY_REORDER_TO_FRONT的目标Activity的onNewIntent中用FLAG_ACTIVITY_NEW_TASK start一个创建即消失的activity
示例:
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Intent trickIntent = new Intent(context, TrickActivity.class);
trickIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(trickIntent);
}
}
其中
public class TrickActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
}
@Override
public void finish() {
super.finish();
// disable the animation
overridePendingTransition(0, 0);
}
}
分享到:
相关推荐
这是一个小项目,用于演示通过正常调用 startActivity 在活动之间切换工作正常,但是当我在 PendingIntent 中发送带有该标志的意图然后调用mPendingIntent.send()该标志似乎是忽略:-(。 与 startActivity 一起快乐...
Intent的FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT Activity的两种启动模式:FLAG_ACTIVITY_CLEAR_TOP和FLAG_ACTIVITY_REORDER_TO_FRONT 1. 如果已经启动了四个Activity:A,B,C和D。在D Activity...
Android translate动画、scale动画、alpha动画、rotate切换动画和Activity动画效果实例,包括了...如果Activity已经启动,并且intent加了FLAG_ACTIVITY_REORDER_TO_FRONT,这样不会新启动Activity,也就没有动画效果。
Given a singly linked list$ L: L_0→L_1→…→L{n-1}→L_n$, reorder it to: $L_0→L_n →L_1→L_{n-1}→L_2→L_{n-2}→…$ You must do this in-place without altering the nodes' values. For example, Given...
release the frame the reorder ring buffer.
介绍了Ajax控件-ReorderList的使用方法:添加数据,修改数据,删除数据,以及拖动排序。除了修改数据有部分代码,其他功能皆无代码(ReorderList的界面拖动排序也无需代码),都是一次性绑定数据源控件。~~还在为网络...
包含hostapd,openssl,libnl的编译说明, route/link/vlan.c:51: error: 'VLAN_FLAG_REORDER_HDR' undeclared here (not in a function)错误的解决办法
bootstrap-table-reorder-columns表格拖拽排序列的一个插件
bootstrap-table-reorder-rows.js ,bootstraptable行拖动
reorder_python_imports 自动重新排序python导入的工具。 与isort类似,但更多地使用静态分析。 安装 pip install reorder-python-imports 控制台脚本 有关完整的选项集,请参阅reorder-python-imports --help 。 ...
ASP.NET AJAX的ReorderList控件是可以实现无排序数据绑定的列表控件,从名字上就可以看出来因为它是Reorder的,也就是说能够通过和服务器端交互数据重新排序绑定的数据项。要实现重排序,用户只需简单的拖动某条记录的...
BootStrapTable行内编辑;压缩包内包含行内编辑所需要的js+css; BootStrapTable行内编辑;压缩包内包含行内编辑所需要的js+css;
SECTION .text:CODE:REORDER:NOROOT(2) Reset_Handler LDR R0, =SystemInit BLX R0 END C程序,CODE_ADDR是应用程序烧写的地址 #include "stm32f4xx.h" #define CODE_ADDR 0x08020000 //typedef unsigned int...
bootstrap-table实现 行拖拽 插件 jquery.tablednd.js bootstrap-table-reorder-rows.js bootstrap-table-reorder-rows.css
bootstraptable拖拽js
Android 中文API 合集(102 篇)
POPUP_MESSAGE Edits the selected feature by rolling back to the model state prior to the feature. ACTIONS STANDARD BUTTON/FOLDED UG_MODELING_EDIT_FEATURE_POSITION LABEL Edit P&ositioning... ...