I have a class called TouchImageView extends ImageView
and I detect where the user clicks on it. If it is a interest point, I want to call a method on the Detailed_Image_Activity
that will update a WebView
. How can I achieve this?
I found some ideas about using observer and observables but I don't know how to do that. I found this solution Equivalent of iOS NSNotificationCenter in Android? but I can't make it work it
This is my code in the TouchImageView
class...
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if(isPointOfInterest) {
//The code below is used to update the WebView
//The task called below exists in the Detailed_Image_Activity
DownloadHighlightBackground HighlightDownloaderTask = new DownloadHighlightBackground();
HighlightDownloaderTask.execute(new String[] { arg1.toString() });
}
}
Try this,
You can get the activity from within the view, in this way..
((MyActivity)getContext()).method_name();