6

I am using facebook sdk in my app. In order not to show the solo progress bar when facebook button is clicked, I am using:

<activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:theme="@android:style/Theme.NoDisplay"
</activity>

However, I think for devices with api 23+ this causes a crash:

"com.facebook.FacebookActivity did not call finish() prior to onResume() completing"

Someone said here:Activity did not call finish? (API 23) by writing:

@Override
protected void onStart() {
    super.onStart();
    setVisible(true);
}

in the problematic activity, they solved the issue. But since I cannot edit FacebookActivity, is there any alternative solution?

Community
  • 1
  • 1
Can Gokdere
  • 286
  • 3
  • 12

3 Answers3

10

Facebook have changed their instructions for initially setting up your project. Just change the theme for the com.facebook.FacebookActivity to @android:style/Theme.Translucent.NoTitleBar.

Newtz
  • 1,333
  • 11
  • 9
0

See javadoc of windowNoDisplay :

(...)your activity must immediately quit without waiting for user interaction(...)

So exception is correct, your use case does not match windowNoDisplay.

koral
  • 2,513
  • 1
  • 32
  • 41
0

This is platform bug.

If you have been using Theme.NoDisplay in one or more activities in your app, and you have not tested them on Android 6.0 yet, I recommend that you do so soon. An undocumented regression in Android 6.0 will cause some of those activities to crash upon launch, if your targetSdkVersion is 23 or higher.

See this blog post: https://commonsware.com/blog/2015/11/02/psa-android-6p0-theme.nodisplay-regression.html

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141