开发者

Android WebView save Picture

I have an application which loads pictures from the Web with WebView and a link.

// (in fact an Ajax app with PHP and JavaSCript xmlHttpREquest in a webpage on the Web)

So briefly there are images displayed in a WebView in 开发者_开发百科this android app, a simple app.

I would like the user to be able to save any images displayed in the WebView to his device with a long click for example, opening a menu or so as in example: in the browser of android it's happening a longclick to save.

Many thanks Regards, Rick ref: http://developer.android.com/reference/android/webkit/WebView.html

code:

package com.example.WebView;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class WebViewActivity extends Activity {
/** Called when the activity is first created. */
WebView mWebView;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl("http://www.example/form.php"); // display some images
}

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜