App Crashes On Calling Webview Loadurl method inside switch <p>my app contains a fragment with a webview and a edit text.i have a navigation drawer with 3 choices and use a switch condition to handle selection,on 3 selections i update the same webview with different html files using the foolowing code ..but my app crashes..</p> <pre><code>@Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments Fragment fragment; switch (position) { case 0: WebView wv = (WebView) findViewById(R.id.webView); wv.loadUrl("file:///android_asset/src/web.html"); //app crashes fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; case 1: fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; case 2: fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; } } </code></pre> <p>my logcat logs <a href="http://pastebin.com/snbzASTq" rel="nofollow">http://pastebin.com/snbzASTq</a></p> <p>please provide a workaround for this</p>