2

I'm having an issue with my app on a Kindle Fire.

I don't have a device of my own, but the app reviewers (and a friend of mine who tested it for me) are having an issue with the app closing, with no error message after coming out of hibernation.

The exact issue is that if you hibernate in portrait, and then come out of hibernation after moving the device in to landscape mode, it simply just displays the home screen. No force close or anything.

The funny thing is that if you're at another activity in the app (it's only got 2 screens) it works just fine. The main menu activity is the one that this happens on. I've checked the onResume for both activities and they're the same. The main menu screen is a ListActivity, though. Could this be part of the issue?

When resuming after changing the orientation, is OnCreate called again?

I'm hoping someone can point me in the right direction because my only method of testing is re-submitting and sending an APK to a friend overseas.

4

2 回答 2

0

我有一个类似的问题,一些带有休眠和改变方向的复杂 Kindle。令人沮丧的是,我什至无法点燃 Kindle,因为它们不运往我的国家。

我可以为您回答的一点是“更改方向后恢复时,是否再次调用 OnCreate?” 我对以下指南的理解是未调用 onCreate,但您必须在恢复和暂停时使用。

“您的应用程序必须考虑 Kindle Fire 上的休眠 - 无论休眠是用户启动的还是屏幕超时后发生的。与快速设置优化类似,休眠优化需要正确处理 onPause() 和 onResume() 方法。”

来自 https://developer.amazon.com/post/Tx385PNGJFMEB4R/Managing-Hibernation-Top-10-App-Optimizations-for-Kindle-Fire.html

我真的很纠结 Kindle 模拟器,大多数时候都无法启动它。

于 2013-11-22T12:03:21.757 回答
0

我也遇到同样的问题。这是因为在 Kindle fire 上,如果用户休眠,改变方向并退出休眠,onConfigurationChanged() 方法会在 onResume() 之前调用。

这是亚马逊在安卓上的碎片化问题。

作为一种解决方法,我声明了两个布尔值 isPaused 和 isActivityNeedReconstructionAfterConfigChange。

代码如下所示: void onPause(){

isPaused = true;

} 无效 onResume(){

if (isPaused && isActivityNeedReconstructionAfterConfigChange){

//do what you do in onConfigurationChanged()
}
isPaused = false;

}

无效 onConfigurationChanged(){

isActivityNeedReconstructionAfterConfigChange = true;

如果(!isPaused){

   isActivityNeedReconstructionAfterConfigChange = false;

   //do what you do in onConfigurationChanged()

}

}

于 2013-12-18T00:59:14.043 回答