如何拦截Android中的blob网址?

时间:2017-07-20 12:34:09

标签: android export blob

我正致力于在我的应用中导出数据。我知道如何创建允许我这样做的Intent,但我无法处理的是我在请求中获得的Blob网址。我不知道如何从中获取图像。这就是它的样子:

I/System.out: blob:null/f7da72d2-a7a7-4cb5-987b-d1e392a14bf1

这是我在类中扩展WebViewClient

的方法
@Override
    public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {


        if( request.getUrl() != null && request.getUrl().toString().startsWith("blob:")){
//This is my miserable attempt to do get the data from blob url..
            String stringURL = request.getUrl().toString();
            byte[] byteURL = stringURL.getBytes();
            Blob blob;
            try {
                blob.setBytes(1, byteURL);
            } catch (SQLException e) {
                e.printStackTrace();
            }


//I will pass the data from blob here, this is just placeholder
            Intent sendIntent = new Intent();
            sendIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_TEXT, "Simple txt");
            sendIntent.setType("text/plain");
            view.getContext().startActivity(sendIntent);
        }


        return super.shouldInterceptRequest(view, request);
    }

0 个答案:

没有答案