Reputation: 31
Instrumentation.ActivityMonitor (IntentFilter which,
Instrumentation.ActivityResult result,
boolean block)
Instrumentation.ActivityMonitor has 3 parameters. I really don't understand the 2nd parameter. According to the documentation, the result will be returned when the monitor is hit.
My question is where the monitor returns the result to. I thought that it would be returned to onActivityResult() of the activity that started the activity associated the monitor, but it's not.
Does anyone have any advice on it?
Upvotes: 2
Views: 717
Reputation: 31
After spending some time to understand the document, I finally have figured it out. Please refer to my own example code at github, https://github.com/minhwang/activity_monitor_example
I can use the second parameter when the activity being monitored is started by startActivityForResult() method. The parameter will be passed to the onActivityResult() of the activity that have started the activity.
Upvotes: 1
Reputation: 1223
May be your result return null as per document it says "Retrieve the result associated with this ActivityMonitor, or null if none." then it returned into
Instrumentation.ActivityResult (int resultCode,
Intent resultData)
here you can get the result using this method
getResultCode()
just try and let me know
Upvotes: 0