Reputation:
On Tumblr, with the post have many images. They will be previewed by a local image. And then, when user click to, they will be replaced by real image. I want to do like that. I have a listview, each item as a post having a webview. I got html string, I replace src of img tag by local image. But I couldn't catch touching event on webview ( webview in listview)
holder.webView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View web, MotionEvent event) {
// TODO Auto-generated method stub
WebView.HitTestResult result = ((WebView)holder.webView).getHitTestResult();
if (result == null) {
return false;
}
int type = result.getType();
String extra = result.getExtra();
return false;
}
});
result variable is always null ??? So the first question: how can I catch the event (touching in img in webview) ?
And then, the second question: How can I replace the touched img (local img) in webview by a real img ( I have the img url) ? Thank in advanced!
Upvotes: 0
Views: 1136
Reputation: 261
Can you try
WebView.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event) {
}
});
and for loading image from URL Load image from url please follow the above link.
Upvotes: 1