开发者

Android: Tilting mobile makes ImageView content disappear / URI refreshed

Thank you in advance for any responses. I am facing rather a trivial problem. Hardware: Motorola (Android phone)

I am displaying an image in an imageview. The image itself is grabbed off a URI via ContentResolver. The problem is that whenever I tilt my mobile, the imageview gets blank. By tracing the log and variables I found out that the relevant URI goes back to its default (i.e. null) value whenever I tilt the mobile.

Of course there is a workaround for it i.开发者_运维技巧e. using static variables. But I am wondering if there is another solution since I would really like to pass the URIs around in functions to do what I desire with my application.

Does anyone know what's going on?

Regards.


Your activity is restarted automatically whenever the orientation changes between portrait and landscape. Check out these two articles for ways to handle this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜