简体   繁体   English

相机屏幕方向问题三星银河S3

[英]Camera screen orientation issue Samsung galaxy S3

在我的应用我试图采取从相机PIC,并在显示它imageview 。一切工作正常,但是当我从三星Galaxy S3了PIC,它改变了方向,并显示相机活动和onActivity导致它显示的PIC在imageView但是在几秒钟内它改变了方向再次将图片从imageview删除了。这很奇怪,我该如何解决这个问题?

This is probably late to answer but I think that your onCreate method is called after the orientation change thus the ImageView bitmap that you are setting is null after orientation change. 这可能是迟到的答案,但是我认为在更改方向后会调用onCreate方法,因此在更改方向后,您要设置的ImageView位图为null。

Try saving your data and variables by Overriding onSaveInstanceState(). 尝试通过覆盖onSaveInstanceState()保存数据和变量。 This method is called each time the orientation changes. 每次方向更改时都会调用此方法。 Save variables and values that you want to retain after orientation change. 保存方向更改后要保留的变量和值。

Hope I am right and this helps! 希望我是对的,这会有所帮助!

Try this: 尝试这个:

LinearLayout myLayout = new LinearLayout(this);
myLayout.setOrientation(LinearLayout.VERTICAL);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM