I'm having some trouble with native code using JNI and I suspect that this is maybe due to a call to setRequestedOrientation()
.
What happens to the activity when I call setRequestedOrientation()
? Is it just restarted or is it entirely destroyed?
Also, what happens the to views? If in onCreate I have :
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
try
{
this.setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE );
setContentView( R.layout.activity_XXX );
mTermScreenView = (TermScreenView) findViewById( R.id.termScreenView );
What happens to the View object? Is it recreated? Does it already exist when I call findViewById()
? Is another View recreated after the screen gets rotated?
When you setRequestedOrientation() the view may be restarted. http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation(int)
Change the desired orientation of this activity. If the activity is currently in the foreground or otherwise impacting the screen orientation, the screen will immediately be changed (possibly causing the activity to be restarted). Otherwise, this will be used the next time the activity is visible.
When you rotate your screen or change the orientation, by default android will destroy and recreate the view. http://developer.android.com/guide/topics/resources/runtime-changes.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With