在Activity中执行viewChange并且收到的intent也不为null。问题是,没有显示错误消息。此外,没有出现错误的规律性。有时视图chage正确完成,但大部分时间没有完成,这会导致黑屏。 当然我更愿意删除这个问题,但是如果有办法检查屏幕现在是否为null并重新尝试启动活动,这也是目前可接受的解决方案。
InteractionManager.handleIntent函数只创建并返回一个意图,我通过它调试了一切,一切按预期工作。 (它只是一个时间陈述)
/**
* Update function that handles timer & content changes
* @param observable Observable that raised the call
* @param property property that is given by the observable
* */
override fun update(observable: Observable?, property: Any?) {
runOnUiThread {
if (property is ViewEvent) {
Log.d(TAG, "Received Event: $property")
if (checkForChange(property)) {
Log.d(TAG, "OK, checked for view change")
InteractionManager.deleteObserver(this)
Log.d(TAG, "OK, view dispached from Observer...")
val it = InteractionManager.handleIntent(property, this)
if(it==null)
Log.e(TAG,"!!!ERROR ERROR INTENT IS NULL!!!")
startActivity(it.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
Log.d(TAG, "OK, view change done")
} else {/*SHOW ALERT WINDOW*/
}
} else if (property is Message) {
synchronized(isCreated) {
Log.d(TAG, "Gathering message: $property")
if (isCreated) {
Log.d(TAG, "Caling display function from update")
processDisplayContent(property)
} else {
Log.d(TAG, "(update) display not created yet")
}
}
}
}
}