I just need to know if it's English go to url2 and if it's Spanish url. I have some layout with strings in Spanish and English and I know how to use them so that it comes out depending on the language of the user, but being a URL, I am not able to make it go to one URL or another.
I tried to put a string and compare or assign numbers but nothing, I'm not capable. The solution would be if (it's English) {go to url2} otherwise (Spanish)
public class Competidores extends android.support.v4.app.Fragment {
WebView appWeb;
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.four_tab, container, false);
String url = " https://rudeboysapp.wordpress.com/";
String url2 = " https://rudeboysappenglish.wordpress.com/";
if(l7 == "es") {
appWeb = (WebView) v.findViewById(R.id.webView);
//Habilitamos el javaScript y el zoom
appWeb.getSettings().setJavaScriptEnabled(true);
// appWeb.getSettings().setBuiltInZoomControls(true);
//Cargamos el enlace definido
appWeb.loadUrl(url);
//Este método es para que el navegador se quede en nuestra aplicación
appWeb.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
}else {
appWeb = (WebView) v.findViewById(R.id.webView);
//Habilitamos el javaScript y el zoom
appWeb.getSettings().setJavaScriptEnabled(true);
// appWeb.getSettings().setBuiltInZoomControls(true);
//Cargamos el enlace definido
appWeb.loadUrl(url2);
//Este método es para que el navegador se quede en nuestra aplicación
appWeb.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
});
}
return v;
}