Issue
I have a MapView and a set of markers on it, I also have a customized ItemizedOverlay class to handle map onTap event. Now, Lets say that I have the MapView in MainMap class and its corresponding CustomItemizedOverlay class. Is there any way to access the components (Eg: change visibility of a button in MainMap class) of the MainMap class from CustomItemizedOverlay's onTap() function??
On googling I came across this, View view = View.inflate(context, R.layout.MAIN_MAP_LAYOUT, false); and using view.findViewById() to access the components. Is this a good idea or is there any other better way to access them.
Any help is appreciated, Thanks in advance..
Solution
You can pass the view you want to access to the Itemized overlay during instantiation (changing the constructor to accept one more parameter) or adding a method to your itmemized overlay to pass the view.
Example:
private View mView;
setViewToChange(View myView){
this.mView = myView;
}
Regards.
Answered By - Luis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.