0

I need to open an XML file stored in a String variable. I want to open it with chrome without saving in the phone storage, is this possible?

I can open chrome using intents but now I need to load the xml file.

public void onClickOpen(View v){

    Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.chrome");

    startActivity(intent);
}

Thanks in advance

mrSaraf
  • 123
  • 1
  • 13
Sad Hyena
  • 291
  • 3
  • 16

1 Answers1

0

If you want to do in a webview it can be done in this way

String mString = "<html><body>You scored <b>192</b> points.</body></html>";

WebView webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadDataWithBaseURL(null,mString,"text/html","UTF-8",null);
Praful Ranjan
  • 117
  • 1
  • 2
  • 13