Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- webView = (WebView)v.findViewById(R.id.webView);
- webView.getSettings().setJavaScriptEnabled(true);
- webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
- webView.getSettings().setDomStorageEnabled(true);
- webView.setWebChromeClient(new WebChromeClient(){
- public void onProgressChanged(WebView view, int progress) {
- getActivity().setTitle("Loading...");
- getActivity().setProgress(progress * 100);
- if(progress == 100)
- getActivity().setTitle("2Mummy");
- }
- });
- webView.loadUrl("http://my_url_here");
- webView.setOnKeyListener(new View.OnKeyListener(){
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK
- && event.getAction() == MotionEvent.ACTION_UP
- && webView.canGoBack()) {
- handler.sendEmptyMessage(1);
- return true;
- }
- return false;
- }
- });
- webView.setWebViewClient(new WebViewClient() {
- public boolean shouldOverrideUrlLoading(WebView view, String url){
- view.loadUrl(url);
- if ((webView.canGoBack()) || (url!=url)){
- }
- else{
- }
- return false;
- }
- @Override
- public void onPageStarted(WebView view, String url, Bitmap favicon){
- }
- @Override
- public void onPageFinished(WebView view, String url){
- webView.setVisibility(View.VISIBLE);
- }
- });
- webView.scrollTo(0,webView.getContentHeight());
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/categoriesfrag"
- tools:context="com.quadcircles.tomummy.Fragment.Categories">
- <WebView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/webView"/>
Add Comment
Please, Sign In to add comment