Yossi Yossi - 1 month ago 9
Android Question

put iframe on android app

I'm try to put my iframe chart that i took from my thingspeak account.

This is the string i need to put(has i took from thingspeak):

<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true" ></iframe>


this what i use on my activity:

WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadData();


I try without success to put my iframe string in "loadData" function.

Thanks to the helpers ;)

Answer Source

You can create a String with the html :

String html = "<iframe width=\"450\" height=\"260\" style=\"border: 1px solid #cccccc;\" src=\"http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true\" ></iframe>";

and then call the method loadData():

webview.loadData(html, "text/html", null);

Click Here for reference