0
私は自分のアプリでデータをエクスポートしようとしています。私はそれを可能にするIntent
を作成する方法を知っていますが、私が対処できないことは、私がリクエストに持っているBlob
URLです。私はそれからイメージを得る方法を知らない。Androidでblob urlをインターセプトする方法は?
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);
}