I have created a webview but it is not showing when I run the app. Does anyone know why?
Here is my code. This is where I load the webview and add a url:
_webView = (WebView) LayoutInflater.from(getBaseContext()).inflate(R.layout.clubdir, null); _webView.getSettings().setJavaScriptEnabled(true); _webView.getSettings().setBuiltInZoomControls(true); _webView.getSettings().setSupportZoom(true); _webView.setWebViewClient(new WebViewClient()); _webView.loadUrl("http://maps.google.com/maps?q=" + Postcode + "&ui=maps"); adapter = new MergeAdapter(); adapter.addView(ImageView); adapter.addView(header); adapter.addView(fixturesView); adapter.addView(header2); adapter.addView(resultsView); adapter.addView(clubinfo); adapter.addView(ClubInfo); adapter.addView(clubdir); adapter.addView(_webView); adapter.addView(moreinfo); adapter.addView(MoreInfo); setListAdapter(adapter); Here is the layout that I am inflating:
<?xml version="1.0" encoding="utf-8"?> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="150dp"> </WebView>
Internetpermission?clubdircontains only webView or anyother? and also, Try to useyourActivity.thisfor inflating theWebViewinstead ofgetBaseContext()