lundi 1 juin 2015

How to access "file:///android_assets" from a unit test

My application interops with a webview to make javascript calls. In my normal application I can set the webview to open, "file:///android_asset/index.html" and the webview loads fine. When I try to do the same thing from within a unit test ""file:///android_asset" does not exist.

Every example I've found has to do with using getInstrumentation().getTargetContext().getAssets().open but that returns an InputStream. InputStreams are not accepted by WebView, I need the path to the file.

How do I get the string path?

Aucun commentaire:

Enregistrer un commentaire