Skip to content Skip to sidebar Skip to footer

Android Application Crashes With Orientation Changes

I have an Android page containg 3 images a background and edit text and button, and the manifest file the activity given as:

Solution 1:

Add to your activity in manifest the following code

<activityandroid:name="SearchScreen"android:configChanges="orientation|keyboardHidden"android:screenOrientation="portrait"android:windowSoftInputMode="stateAlwaysHidden"></activity>

You can also use Async task to make this happen so that.

Solution 2:

If you have heavy bitmaps in your layout try calling recycle for them in activity's onDestory method

@OverridepublicvoidonDestroy(){
    ImageViewimageViewWithHeavyBitmap= (ImageView)findViewById(R.id.imageview);
    imageViewWithHeavyBitmap.getDrawable().getBitmap().recycle();
}

Post a Comment for "Android Application Crashes With Orientation Changes"