-2

When my application's orientation change every time onCreate() method call. It makes me difficult to handle GUI in Activity.

can I avoid onCreate() method one Activity has been created and started?

I don't want to make screen as static as portrait or landscape

is there any way to avoid onCreate() method?

Thank You.

user861973
  • 787
  • 3
  • 11
  • 26

2 Answers2

1

No, that is not possible. Dalvik will hate you if don't call the super.onCreate() and will throw you a mean SuperNotCalledException.

Kimi
  • 6,239
  • 5
  • 32
  • 49
1

This may get mixed responses, but the best I've been able to find is by adding android:configChanges="orientation|keyboardHidden" to your activity in the AndroidManifest.xml.

<activity
    android:configChanges="orientation|keyboardHidden"
    android:name=".ActivityName">

There are other answers.

Note: If you mean you never want it called, then no, it has to be called.

Community
  • 1
  • 1
Ricky
  • 7,785
  • 2
  • 34
  • 46