Android, how to not destroy the activity when I rotate the device? -
i have app works in portrait mode, , have made changes in manifest file every activity orientation portrait. when rotate device, activity recreates again. how not destroy activity?
for api 12 , below: add
android:configchanges="orientation"
add "screensize" if targeting api 13 or above because whenever orientation changes screen size, otherwise new devices continue destroy activity. see egg's answer below more information on using "screensize"
android:configchanges="orientation|screensize"
to activity in androidmanifest.xml. way activity wont restarted automatically. see the documentation more infos
Comments
Post a Comment