Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable onCreate action when will orientation be changed?

Tags:

java

android

How can I disable onCreate event when I turn my device from portrait orientation? Because when application starts it will get much of its data from the Internet, and it will be bad to download this data every time the user turns his device.

like image 636
user1023177 Avatar asked Nov 01 '11 06:11

user1023177


1 Answers

In Activity tag of manifest write

android:configChanges="orientation|screenSize"

example:

<activity android:name=".MainActivity"
            android:configChanges="orientation|screenSize">
like image 70
Shailendra Singh Rajawat Avatar answered Nov 15 '22 15:11

Shailendra Singh Rajawat