在我的应用我试图采取从相机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.
Try saving your data and variables by Overriding 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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.