开发者

ListView position onStart

If I launch an activity from my ListView, when I go back to the ListView it is reset back to the beginning - the original position within the ListView is lost.

This does not happen if I change the orientation of the device. onRestoreInstanceState is called and the position within the ListView is maintained.

  1. What is causing the position in my ListView to be reset when it is covered by an activity? Note that onDestroy is not being called, just onPause(), onStop(), onStart() and on开发者_StackOverflowResume(). The position is OK after onStop() and is already reset when onStart() is called.

  2. If I have to manage this myself what's the best method? I can save off the position with getFirstVisiblePosition() and restore it with setSelection(). But I'd really like the position to be stored in the instance state. Any suggestions here?

Regards

Phil


Maybe you are creating a ListView in the onStart method. If yes, create it in the onCreate method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜