In my app i am trying to take a pic from camera and displaying it in the imageview
.Everything works fine but when i took pic from samsung galaxy s3 , it changed the orientation and displays the camera activity and onActivity
result it displayed the pic in the imageView
but in a fraction of seconds it changed the orientation again removed the pic from imageview
.Its very weird how can i resolve this issue?
问问题
1042 次
2 回答
2
这可能迟到了,但我认为您的 onCreate 方法是在方向更改后调用的,因此您设置的 ImageView 位图在方向更改后为空。
尝试通过覆盖 onSaveInstanceState() 来保存数据和变量。每次方向改变时都会调用此方法。保存在方向更改后要保留的变量和值。
希望我是对的,这会有所帮助!
于 2013-01-18T13:28:43.980 回答
-1
尝试这个:
LinearLayout myLayout = new LinearLayout(this);
myLayout.setOrientation(LinearLayout.VERTICAL);
于 2012-12-27T06:27:55.830 回答