我有一个名为TouchImageView extends ImageView
的类,我检测用户点击它的位置。如果这是一个兴趣点,我想在Detailed_Image_Activity
上调用一个方法来更新WebView
。我怎样才能做到这一点?从视图调用活动
我发现了一些关于使用observer和observables的想法,但我不知道该怎么做。我发现这个解决方案Equivalent of iOS NSNotificationCenter in Android?但我不能让它工作,它
这是我在TouchImageView
类代码...
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() });
}
}
这可能帮助:http://developer.android.com/reference/android /content/BroadcastReceiver.html – AJcodez