-
-
Save hi-manshu/e7a2b8ee90695f25794f4043dd4ea16e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.teamshunya.silencio.Activities.ShowActivity.SwipableLayout; | |
import android.app.ProgressDialog; | |
import android.content.Context; | |
import android.net.Uri; | |
import android.os.AsyncTask; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v4.app.Fragment; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.webkit.WebView; | |
import android.webkit.WebViewClient; | |
import android.widget.ProgressBar; | |
import com.teamshunya.silencio.R; | |
import java.util.ArrayList; | |
public class Cabs extends Fragment { | |
private WebView myWebView; | |
final static String myBlogAddr = "http://m.uber.com"; | |
String myUrl; | |
public Cabs() { | |
} | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View v = inflater.inflate(R.layout.fragment_cabs, container, false); | |
myWebView = (WebView) v.findViewById(R.id.webView); | |
myWebView.getSettings().setJavaScriptEnabled(true); | |
myWebView.setWebViewClient(new MyWebViewClient()); | |
if (myUrl == null) { | |
myUrl = myBlogAddr; | |
} | |
myWebView.loadUrl(myUrl); | |
return v; | |
} | |
@Override | |
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
super.onViewCreated(view, savedInstanceState); | |
} | |
private class MyWebViewClient extends WebViewClient { | |
@Override | |
public boolean shouldOverrideUrlLoading(WebView view, String url) { | |
myUrl = url; | |
view.loadUrl(url); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment