Open Noitidart opened 8 years ago
Hi there @cscott I've been doing JNI.jsm for sometime and got pretty decent at it. Based on my learnings I wrote the docs on MDN -
However today I got an interesting question.This user is starting an activity with startActivityForResult - http://stackoverflow.com/a/35416176/1828637
startActivityForResult
He now wants to respond to the onActivityResult. The docs for it are here - http://developer.android.com/training/basics/intents/result.html#ReceiveResult
onActivityResult
It says this onActivityResult is a protected method on the activity - http://developer.android.com/reference/android/app/Activity.html#startActivityForResult%28android.content.Intent,%20int%29
I see android devs out there are hooking this, they do this:\ override the method and call the original method at the end of it**.
@Override final public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); }
https://github.com/thankimanish/Android/blob/0e3359822935f35d6689b96938189f86afb51688/AndroidBasicDemo/src/com/hdik/main/common/library/BaseFragmentActivity.java#L22
How can we also override this? Calling the super class onActivityResult with the arguments - http://stackoverflow.com/questions/16928459/how-to-call-an-a-overridden-super-class-method-in-java-through-jni - is the second step after overriding.
I researched on Stackoverflow jni tag - http://stackoverflow.com/search?q=[jni]+onActivityResult - but could not figure it out.
Could you help please.
Thanks
Hi there @cscott I've been doing JNI.jsm for sometime and got pretty decent at it. Based on my learnings I wrote the docs on MDN -
However today I got an interesting question.This user is starting an activity with
startActivityForResult
- http://stackoverflow.com/a/35416176/1828637He now wants to respond to the
onActivityResult
. The docs for it are here - http://developer.android.com/training/basics/intents/result.html#ReceiveResultIt says this onActivityResult is a protected method on the activity - http://developer.android.com/reference/android/app/Activity.html#startActivityForResult%28android.content.Intent,%20int%29
I see android devs out there are hooking this, they do this:\ override the method and call the original method at the end of it**.
https://github.com/thankimanish/Android/blob/0e3359822935f35d6689b96938189f86afb51688/AndroidBasicDemo/src/com/hdik/main/common/library/BaseFragmentActivity.java#L22
How can we also override this? Calling the super class
onActivityResult
with the arguments - http://stackoverflow.com/questions/16928459/how-to-call-an-a-overridden-super-class-method-in-java-through-jni - is the second step after overriding.I researched on Stackoverflow jni tag - http://stackoverflow.com/search?q=[jni]+onActivityResult - but could not figure it out.
Could you help please.
Thanks