I'm trying to make an advanced custom component that should be able to start an n开发者_开发技巧ew activity to allow the user to make his/her choice more easily.
Normally, you can start an activity and fetch the result by using startForResult() and onActivityResult() . But these methods aren't available in my custom component, and I have no idea how to create a hook in the onActivityResult()-function of the parent activity.
Overloading the Activity with a custom onActivityResult doesn't seem sufficient because my custom component will be used multiple times in the same Activity, and I don't see how I can know which of my custom components fired the initial request-intent..
by passing requestCode you can easily do this. just make one setter and getter for requestCode and pass unique request code in every custom class and u can achieve your task.
精彩评论