Is it possible to add Voltichange Widget to Android Java App

36 views Asked by At

I would like to add Voltichange widget to my java app. The instructions to add it to a website are posted below and I was wondering if its possible to add it to an android java app. I am also unsure if I need the first part of adding the link tag or messing with the css if it will be in a WebView.


  1. Place this link tag on the of your page:
<link rel="stylesheet" href="https://voltichange.net/css/widget.css" />
  1. Place this iframe tag at the location where the Voltichange Widget will be:
<iframe
src="https://voltichange.net/api/widget/?chain=1&darktheme=false&tokenin=Native&tokenout=0x7f792db54B0e580Cdc755178443f0430Cf799aCa&slippage=1"
frameborder="0"
class="voltichange-widget"></iframe>

I have tried adding the iframe code as a string like this

String html = "<iframe src=\"https://voltichange.net/api/widget/?chain=1& \n darktheme=false& \n tokenin=Native& \n tokenout=0x7f792db54B0e580Cdc755178443f0430Cf799aCa& \n slippage=1\" \n frameborder=\"0\" \n class=\"voltichange-widget\"></iframe>";

and then I added

wv.loadData(html, "text/html", null);
        webSettings = wv.getSettings();
        webSettings.setJavaScriptEnabled(true);

but the webview is just a white screen. I also have internet permissions.

1

There are 1 answers

0
Worthy On

It seems like you are on the right track with loading the HTML string into a WebView. Ensure that your HTML string is properly formatted. In your provided code, there are unnecessary line breaks and spaces. Try simplifying it to a single line:

String html = "<iframe src=\"https://voltichange.net/api/widget/?chain=1&darktheme=false&tokenin=Native&tokenout=0x7f792db54B0e580Cdc755178443f0430Cf799aCa&slippage=1\" frameborder=\"0\" class=\"voltichange-widget\"></iframe>"