Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

requestFeature() must be called before adding content #211

Open
vkalmath opened this issue Sep 26, 2017 · 1 comment
Open

requestFeature() must be called before adding content #211

vkalmath opened this issue Sep 26, 2017 · 1 comment

Comments

@vkalmath
Copy link

vkalmath commented Sep 26, 2017

General information

  • SDK/Library version: 5.1.1
  • Android Version and Device: Any device, version < Android 5.0

Issue description

When we perform
Intent scanIntent = new Intent(getActivity(), CardIOActivity.class);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_CONFIRMATION, true);
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, true);
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
startActivityForResult(scanIntent, SCAN_REQUEST_CODE);

we get
09-26 11:24:04.443 3210-3210/com.asda.android E/card.io: Unknown exception, please post the stack trace as a GitHub issue
android.util.AndroidRuntimeException: requestFeature() must be called before adding content
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:301)
at android.app.Activity.requestWindowFeature(Activity.java:3596)
at io.card.payment.CardIOActivity.android22AndBelowHandleCamera(CardIOActivity.java:419)
at io.card.payment.CardIOActivity.onCreate(CardIOActivity.java:395)
at android.app.Activity.performCreate(Activity.java:5937)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

We tried with
@OverRide
public void onCreate(Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
super.onCreate(savedInstanceState);
<--Code removed for readability-->
}

@dimasikturbo
Copy link

we got hit with the same issue, it turned out a 3rd party library was hooking up to activity lifecycle call backs via Application.registerActivityLifecycleCallbacks and it was causing this exception

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants