Last night, this code (which I found here) showed all kinds of Log
output as I rotated my Android device, values from 0 to 360 and maybe some negatives.
But it doesn't work today. No Log
output. I put a breakpoint on the Log
statement; no stop when debugging.
I changed a few lines this morning to set a value based on value of orientation
and then the problem (no output) surfaced, so I used Show history
to revert back to the version of MainActivity.java
that was last active last night. But no output and no stop at Log
statement when debugging.
What explains this?
import android.app.Activity;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.util.Log;
import android.view.OrientationEventListener;
public class MainActivity extends Activity
{
OrientationEventListener myOrientationEventListener ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myOrientationEventListener = new OrientationEventListener(this,
SensorManager.SENSOR_DELAY_NORMAL)
{
@Override
public void onOrientationChanged(int orientation)
{
Log.w("Orient", orientation + "");
myOrientationEventListener.enable();
}
};
}
}
** EDIT **
As requested, here's AndroidManifest.xml
, unchanged since 2/19, according to Show history
, but I'll gladly add permission; but how did it work last night? [Also: Added line that stands out inside <activity
as suggested in first Answer.]
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dslomer64.nowweregettinsomewheres.fragments"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.dslomer64.nowweregettinsomewheres.fragments.MainActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Here's Android Studio 1.5.1 output:
02-24 12:55:12.554 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
02-24 12:55:12.632 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
02-24 12:55:12.632 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getExtractedText on inactive InputConnection
02-24 12:55:12.670 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
02-24 12:55:12.672 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection
02-24 12:55:12.673 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getSelectedText on inactive InputConnection
02-24 12:55:12.674 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
02-24 12:55:12.674 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
02-24 12:55:13.031 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
02-24 12:55:13.032 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
02-24 13:00:07.936 14836-14836/com.bffmedia.hour8app.intro W/InputMethodManager: startInputInner : InputBindResult == null
02-24 13:00:07.946 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
02-24 13:04:06.824 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
02-24 13:04:06.973 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getExtractedText on inactive InputConnection
02-24 13:04:07.022 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
02-24 13:04:07.022 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection
02-24 13:04:07.023 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: getSelectedText on inactive InputConnection
02-24 13:04:07.025 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
02-24 13:04:07.025 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
02-24 13:04:07.402 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
02-24 13:04:07.402 14836-14836/com.bffmedia.hour8app.intro W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection