Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have a few choices:</p> <ol> <li><p>You can move your sensor listener into your application class, defined by <code>android:name</code> in <code>&lt;application&gt;</code> in your manifest. See <a href="http://developer.android.com/guide/topics/manifest/application-element.html#nm" rel="nofollow">here</a>, naming a class that you've derived from <a href="http://developer.android.com/reference/android/app/Application.html" rel="nofollow">android.app.Application</a>. I would recommend this approach.</p></li> <li><p>You can add <code>android:configChanges="orientation"</code> to your activity manifest but, as described <a href="http://developer.android.com/guide/topics/manifest/activity-element.html#config" rel="nofollow">here</a>, you'll need to handle the reloading of appropriate resources, such as orientation specific layout, in the <code>onConfigurationChanged()</code> of your activity. I wouldn't recommend this as you would still have the issue of the monitoring disappearing when the other configuration changes occur or you will need to work out how your application should handle them (and add them to the list of changes in <code>android:configChanges</code>).</p></li> <li><p>Disabled orientation changes entirely for your application by using <code>android:screenOrientation</code> as described <a href="http://developer.android.com/guide/topics/manifest/activity-element.html#screen" rel="nofollow">here</a>, but I really wouldn't recommend this unless there are other reasons why you want your application to only work in a certain orientation.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload