razorpay / razorpay-android-sample-app

Sample app demonstrating integration of Razorpay checkout
MIT License
88 stars 90 forks source link

Activity get destroyed by throwing "java.lang.IllegalStateException: FragmentManager has been destroyed" on destroy method after calling open method on android #376

Open jayeshmohan94 opened 3 weeks ago

jayeshmohan94 commented 3 weeks ago

Description

I integrated Razorpay android SDK by the instruction given in Razorpay official document. I initiated Razorpay in an activity by calling Checkout.preload(getApplicationContext()); in onCreate() method. Then i called checkout.open on a scenario to open checkout page of Razorpay. After some seconds my Activity get destroyed. I debug in OnDestroy() method of my activity and show error "java.lang.IllegalStateException: FragmentManager has been destroyed". After payment success/Failure my activity is recreated. I don't know why my activity is destroyed and recreated. Please help to sort out this error.

Razorpay SDK Version :

'com.razorpay:checkout:1.6.40'

Android OS Version :

Not Specific version. Getting in all versions of Android

What you did:

Integrated Razorpay SDK as per Document

What happened:

This is what happend after called checkout code (this method-->checkout.open)

RAZORPAY

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Call Razorpay checkout method
  2. Activity got destroyed
  3. Activity recreated after payment success/failure scenario

Suggested solution:

Need to know why activity is destroying. Need to prevent it from destroying and proper function should be work.

Code example, screenshot, or link to a repository:

Code Sample in scrennshot

razor pay 2