我怎么可以停止重启或屏幕方向回顾上创建(),我想停止活动对屏幕方向的娱乐。由于事先请告诉我任何更好的解决方案的真正创造一个问题。就像在我的计划,我选择了一些图片,但对屏幕方向的图像熄灭所以这就是为什么我要停止活动的娱乐屏幕方向。
在此输入code
公共无效的onCreate(包savedInstanceState)
{
super.onCreate(savedInstanceState);
的setContentView(R.layout.mainwindow);
Toast.makeText(getApplicationContext(),一,1).show();
位图=(位图)getLastNonConfigurationInstance();
//Toast.makeText(getApplicationContext(),"a1,1).show();
如果(savedInstanceState!= NULL)
{
位= BitmapFactory.de codeFILE(mImageCaptureUri.getPath());
Toast.makeText(getApplicationContext(),preVIEW具有值,1).show();
preview.setVisibility(View.VISIBLE);
From_Folder.setVisibility(View.GONE);
From_Camera.setVisibility(View.GONE);
preview.setImageBitmap(位);
}
解决方案
最多 API 13
有一个新值 configChanges
属性, 屏幕尺寸
因此,如果您使用的是大屏幕一定要增加屏幕尺寸在configChanges属性:
安卓configChanges =定位| keyboardHidden |屏幕尺寸
how i can stop the restarting or recalling of on create() on screen orientation ,i want to stop the recreation of activity on screen orientation. thanks in advance please tell me any better solution its really creating a problem. like in my program i am selecting some picture but on screen orientation the image goes off so thats why i want to stop the recreation of activity on screen orientation.
enter code here
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mainwindow);
Toast.makeText(getApplicationContext(),"a", 1).show();
bitmap = (Bitmap)getLastNonConfigurationInstance();
//Toast.makeText(getApplicationContext(),"a1", 1).show();
if (savedInstanceState != null)
{
bitmap=BitmapFactory.decodeFile(mImageCaptureUri.getPath());
Toast.makeText(getApplicationContext(),"preview have value", 1).show();
preview.setVisibility(View.VISIBLE);
From_Folder.setVisibility(View.GONE);
From_Camera.setVisibility(View.GONE);
preview.setImageBitmap(bitmap);
}
解决方案
Up to API 13
there was a new value to the configChanges
attribute, screenSize
So if you're using large screens make sure to add screenSize in your configChanges attribute:
android:configChanges="orientation|keyboardHidden|screenSize"
相关推荐
最新文章