Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onActivityResult not called inside of Fragment #55

Open
YudizMohitS opened this issue Jan 4, 2021 · 7 comments
Open

onActivityResult not called inside of Fragment #55

YudizMohitS opened this issue Jan 4, 2021 · 7 comments

Comments

@YudizMohitS
Copy link

Is there any way to get a callback from Fragment?

@Rahul-Hooda
Copy link
Contributor

@YudizMohitS - When calling startPayUMoneyFlow(), don't use activity context and just pass this.

@YudizMohitS
Copy link
Author

@Rahul-Hooda Thanks. for your reply but this is not work with Fragment

I am using this lib implementation 'com.payumoney.sdkui:plug-n-play:1.6.1'

@Rahul-Hooda
Copy link
Contributor

@YudizMohitS - You must be calling below integration function from your code -

// Invoke the following function to open the checkout page.
PayUmoneyFlowManager.startPayUMoneyFlow(
PayUmoneySdkInitializer.PaymentParam paymentParam,
Activity context,
int style,
boolean isOverrideResultScreen)

Now, when calling this from Activity, you can pass this which will pass activity context. In your case, you are calling it from inside a fragment. Please make sure to pass your fragment context and you shouldn't pass getActivity() in this.

@YudizMohitS
Copy link
Author

YudizMohitS commented Jan 5, 2021

@Rahul-Hooda How can I pass this inside of Fragment because there is an Activity context in startPayUMoneyFlow method.
Below is my SS

https://imgur.com/kBlF9dl

@Rahul-Hooda
Copy link
Contributor

@YudizMohitS - Yes. Activity context is consumed by the method. In this case, onActivityResult() of your activity will be called. From there you can consume the result.

@YudizMohitS
Copy link
Author

@Rahul-Hooda But my question is there is any way to handle inside of Fragment?

@Rahul-Hooda
Copy link
Contributor

@YudizMohitS - No, You can not handle it inside Fragment. The only way to handle it is through the Activity's onActivityResult()

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

No branches or pull requests

2 participants