Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

android - how to stop activity recreation on screen orientation?

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);


    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...