As a newcomer to the Android platform, I am working on creating an app using webview and JavaScript. However, when I try to run my code on a real device, I see nothing displayed on the screen. Any assistance or guidance on this issue would be greatly appreciated. Here is the code snippet that I have been working on:
public class MainActivity extends AppCompatActivity { WebView view_1,view_2; ImageView imageView;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().hide(); String url_1="<script type=\"text/javascript” src=\"http://ds.claymcenter.com/embed.js\">\n" + "requestAd('Rh8uGpcrlYMjXN1s', 'banner', 'ads', '320' , ‘50');\n" + "</script>\n" + " \n" + "<div id='ads'></div>"; String url_2="https://paytm.com/"; view_1 = (WebView) findViewById(R.id.webViewGoogle); view_2 = (WebView) findViewById(R.id.webViewFacebook); view_1.getSettings().setJavaScriptEnabled(true); view_1.loadData(url_1, "text/html", null); view_2.getSettings().setJavaScriptEnabled(true); view_2.loadUrl(url_2); imageView = (ImageView) findViewById(R.id.imageView); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { view_1.reload(); view_2.reload(); } }); } }