I can’t reload the WebView which is in Fragment. I call it in mainactivity
so trying to call it in activit
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_progress_show) { progress_menu_item.setActionView(R.layout.menu_item_layout); //Так я его призываю TwoFragment fragment = new TwoFragment(); fragment. Refress(); return true; } return super.onOptionsItemSelected(item); } And this method in fragment
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v=inflater.inflate(R.layout.fragment_two, container, false); final PullRefreshLayout layout = (PullRefreshLayout) v.findViewById(R.id.swipeRefreshLayout); layout.setEnabled(false); mWebView = (WebView) v.findViewById(R.id.webview); mWebView.loadUrl("http://premiumdental.az/wp-content/uploads/vtour/tour.html"); // Enable Javascript WebSettings webSettings = mWebView.getSettings(); webSettings.setJavaScriptEnabled(true); //metodi optimizacii mWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); if (Build.VERSION.SDK_INT >= 19) { // chromium, enable hardware acceleration mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else { // older android version, disable hardware acceleration mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); } mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); // Force links and redirects to open in the WebView instead of in a browser mWebView.setWebViewClient(new WebViewClient()); return v; //пытаюсь перезагрузить его при нажатии в актити } public void Refress(){ mWebView.reload(); } }