My OF app crashes when I press back button on my Android phone.
The logcat shows these errors right before the crash.
06-30 00:11:35.851 14319-14349/? A/libc: Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1), thread 14349 (Thread-50619)
And this is my Manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.openframeworks.androidEmptyExample"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".OFActivity"
android:label="@string/app_name"
android:screenOrientation="reverseLandscape"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
And when I search “onBackPressed” from my whole source files, I only found this part in OFAndroid.java file.
/**
*
* @param keyCode
* @param event
* @return true to say we handled this, false to tell Android to handle it
*/
public static boolean keyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0)) {
if( onBackPressed() ) {
return true;
} else {
// let the Android system handle the back button
return false;
}
}
if (KeyEvent.isModifierKey(keyCode)) {
/* Android sends a shift keycode (for instance),
then the key that goes with the shift. We don't need the first
keycode, that info is in event.getMetaState() anyway */
return false;
}
else
{
int unicodeChar = event.getUnicodeChar();
onKeyDown(unicodeChar);
// return false to let Android handle certain keys
// like the back and menu keys
return false;
}
}
I would love to hear any advice.
Thanks!