App crash when call any method in onActivityResult


#1

Hello everyone,

I was trying to implement BrainTree payment method but when I was trying to call alert method from onActivityResult the app showing following error:

08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.callJSMethodNative(Native Method)
08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.callJSMethod(Runtime.java:912)
08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.callJSMethod(Runtime.java:896)
08-24 03:48:53.451  5276  5276 E WindowManager:         at com.tns.Runtime.callJSMethod(Runtime.java:888)

Details code here: https://github.com/NativeScript/android-runtime/issues/831#issuecomment-324443934

Please give me suggestion. Thanks in advance.


#2

Perhaps you need to wait a little (setTimeout) in the callback before showing an alert.


#3

Thank you !! Is that bug? But setTimeout works.


#4

I guess you need to wait for the other (BrainTree) activity to fully go away before showing a UI widget from your (NativeScript) activity.

By the way, this issue and about 3 others I encountered today inspired this tweet: https://twitter.com/eddyverbruggen/status/900645445638266880