WebView in Android Java error and not working

I am using WebView in my android code to load contents from my another site,

Following code is used,

super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView WebView = (WebView) findViewById(R.id.WebView); WebView.loadUrl("http://www.chennai.indiacitys.com"); WebView.setWebViewClient(new ClassifiedsClient()); WebSettings webSettings = WebView.getSettings(); webSettings.setJavaScriptEnabled(true); }

private class ClassifiedsClient extends myClassifiedsClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); return true; } }

Layout looks as below,
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.indiacitys.chennaiclassifieds.MainActivity"> <WebView android:id="@+id/myWebView" android:layout_height="fill_parent" android:layout_width="fill_parent" android:scrollbars="none" xmlns:android="http://schemas.android.com/apk/res/android"> </WebView> </RelativeLayout>

Could you please help me why it is not working?
Sign In or Register to comment.