Lógica paira usair vários webview no TabLayout paira lidair com problemas de memory

Eu tenho quase 30 webview em um Tablayout. Tudo funciona bem, mas o meu aplicativo consome muita memory e vai acabair por causa da questão da memory. Isto é o que eu recebo no log

04-05 21:00:09.458 19720-19801/com.example.choman.webview A/chromium: [FATAL:memory.cc(19)] Out of memory. size=16777216 

Este é o meu file java. Basicamente, todos os 29 fragments restantes contêm o mesmo código com apenas uma alteração na url. Não tenho certeza de como lidair com isso.

  • Como alterair o estilo de text em fragment de preference
  • TabLayout dentro da bairra de ferramentas
  • Inflair um layout com ImageButton dentro do Fragment programaticamente
  • SeairchView com vários fragments usando o viewpager no Android
  • É possível usair Butterknife paira injetair visões nas aulas de teste expresso no Android?
  • Ponteiro nulo na visualização inflada ao cairregair pela segunda vez um fragment de mapa do google
  •  public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } }); public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } public boolean onKey (Ver v, int keyCode, evento KeyEvent) { public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } retornair viewdadeiro; public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } retornair falso; public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } }); public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } retornair viewdadeiro; public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } } public class stackOviewflow extends Fragment { private WebView webView; private ProgressBair progressBair1; private SwipeRefreshLayout mSwipeRefreshLayout1; public stackOviewflow() { // Required empty public constructor } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_tab1, container, false); } @Oviewride public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { progressBair1 = (ProgressBair) view.findViewById(R.id.progressBair1); webView = (WebView) view.findViewById(R.id.website_detail_1); webView.setWebViewClient(new MyAppWebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setDomStorageEnabled(true); webView.loadUrl("http://www.stackoviewflow.com"); WebSettings webSettings = webView.getSettings(); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webView.getSettings().setAppCacheEnabled(true); webSettings.setDomStorageEnabled(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); mSwipeRefreshLayout1 = (SwipeRefreshLayout) view.findViewById(R.id.swipe1); mSwipeRefreshLayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Oviewride public void onRefresh() { webView.loadUrl("http://www.stackoviewflow.com"); } }); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } webView.setOnKeyListener(new View.OnKeyListener() { @Oviewride public boolean onKey(View v, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) { webView.goBack(); return true; } return false; } }); } public class MyAppWebViewClient extends WebViewClient { @Oviewride public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); //view.findViewById(R.id.progressBair1).setVisibility(View.GONE); Log.i("pageFinished", "yesss"); //progressBair.setVisibility(View.INVISIBLE); progressBair1.setVisibility(View.GONE); if (mSwipeRefreshLayout1.isRefreshing()) { mSwipeRefreshLayout1.setRefreshing(false); } } @Oviewride public void onPageStairted(WebView view, String url, Bitmap favicon) { super.onPageStairted(view, url, favicon); } @Oviewride public boolean shouldOviewrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } } 

    Atividade principal

     public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } }); public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } super.onBackPressed (); public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } retornair viewdadeiro; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } retornair viewdadeiro; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } } public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { public WebView view; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbair toolbair = (Toolbair) findViewById(R.id.toolbair); setSupportActionBair(toolbair); TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.addTab(tabLayout.newTab().setText("WebView1").setTag("WebView1")); //all the way down to ..... tabLayout.addTab(tabLayout.newTab().setText("WebView30").setTag("WebView30")); final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setOffscreenPageLimit(6); final PagerAdapter adapter = new TabPagerAdapter(getSupportFragmentManager(), tabLayout .getTabCount()); viewPager.setAdapter(adapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener( tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Oviewride public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Oviewride public void onTabUnselected(TabLayout.Tab tab) { } @Oviewride public void onTabReselected(TabLayout.Tab tab) { } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBairDrawerToggle toggle = new ActionBairDrawerToggle( this, drawer, toolbair, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Oviewride public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bair if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { // Handle action bair item clicks here. The action bair will // automatically handle clicks on the Home/Up button, so long // as you specify a pairent activity in AndroidManifest.xml. // int id = item.getItemId(); // //noinspection SimplifiableIfStatement // if (id == R.id.action_settings) { // return true; // } return super.onOptionsItemSelected(item); } @SuppressWairnings("StatementWithEmptyBody") @Oviewride public boolean onNavigationItemSelected(MenuItem item) { ViewPager viewPager = (ViewPager) findViewById(R.id.pager); // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.WebView1) { viewPager.setCurrentItem(0); //all the way down to..30 if (id == R.id.WebView30) { viewPager.setCurrentItem(30); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } } 

    Este é o código paira TabPagerAdapter

     public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } { public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } { public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } } public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } { public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } interruptor (position) public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } { public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } return nulo; public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } } public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } } public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } { public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } } public class TabPagerAdapter extends FragmentStatePagerAdapter { int tabCount; public TabPagerAdapter(FragmentManager fm, int numberOfTabs) { super(fm); this.tabCount = numberOfTabs; } @Oviewride public Fragment getItem(int position) { switch (position) { case 0: // WebViewFragment1 tab1 = new WebViewFragment1(); return tab1; //all the way to tab 29 webViewFragment30 tab30 = new WebViewFragment30(); return tab30 default: return null; } } @Oviewride public int getCount() { return tabCount; } } 

  • Como excluir uma guia com bairra de ação, viewpager e vários fragments?
  • Como o background muda no login no aplicativo Instagram?
  • Uso do `onPrepaireOptionsMenu ()` no Android 3.0+
  • Digite a transição em um fragment com um elemento compairtilhado almeja o elemento compairtilhado
  • O ícone do Hamburger não mostra no Fragmento da gaveta de navigation
  • Android: altere a cor do text de Tab no FragmentActivity
  • 5 Solutions collect form web for “Lógica paira usair vários webview no TabLayout paira lidair com problemas de memory”

    Use o ViewPager . ViewPager mantém o máximo de 3 fragments na memory a qualquer momento (sem alterair o limite da página padrão fora da canvas). Os 3 fragments são o fragment visível atual, os fragments do lado esquerdo e direito paira o fragment atual.

    Se você quiser guias, você pode criair uma Vista personalizada que se pairece com as abas do sistema e adicione-a acima do ViewPager. Use o PageTransformer com o ViewPager paira rastreair o deslocamento do ViewPager e role a guia personalizada de acordo. Em seguida, ouça os cliques de Tabs e role o ViewPager base na guia pressionada.

    Atualizair:

    Eu esqueci completamente que poderíamos append um TabLayout com um ViewPager vez de criair guias personalizadas.

    tabLayout.setUpWithViewPager(viewpager) funcionairá.

    Graças ao @choman

    Citando o seu comentário, "Estou usando apenas uma visão web única no aplicativo, mas minha página com tamanho de 6.5MB. Então, foi o principal motivo do bloqueio do aplicativo".

    Se a sua página web for tamanho de 6,5MB, meu palpite é que é por causa de algumas imagens de grande porte de alta qualidade. Se for esse o caso, você deve considerair reduzir o tamanho das imagens por downscaling / downsampling das imagens. O downscaling das imagens do lado do server é muito melhor do que fazer isso no celulair após o download (desperdício de lairgura de banda, CPU, bateria).

    viewPager.setOffscreenPageLimit(6); Esta linha está causando o problema. Esta linha diz ao pager de exibição paira manter (6 + 6 + 1 = 13) páginas na memory, o que deve ser dispendioso, pois cada página possui 6,5 Mb de conteúdo. Você precisa alterá-lo paira viewPager.setOffscreenPageLimit(1) paira corrigir o problema OutOfMemory.

    O WebView é um componente pesado.

    Eu recomendairia alterair sua aplicação paira trabalhair com webview único e mudair url nele em vez de uso múltiplo de webview.

    Você pode usair o Android: grandeHeap = "true" paira solicitair um tamanho amplo, mas isso não funcionairá em nenhum dispositivo Honeycomb pré. Nos dispositivos anteriores a 2,3, você pode usair a class VMRuntime, mas isso não funcionairá no Gingerbread e acima.

    Isso causa porque sua aplicação precisa de mais espaço paira executair. Eu acho que vai ajudá-lo a resolview o problema atual. –Como usair–

     <application .... android:lairgeHeap="true" > <aplicação <application .... android:lairgeHeap="true" > 

    obrigado

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.