Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ;)

like image 981
Yossi Avatar asked Apr 05 '15 23:04

Yossi


Video Answer


1 Answers

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

like image 182
Arlind Avatar answered Sep 28 '22 21:09

Arlind