I want to have the phone screen change to landscape mode when a particular
page is loaded in webview. My code is not working. There are no errors.
It's just simply not changing into landscape mode when the particular page
is loaded in webview. Is there something I forgot or am I doing it
incorrectly. I don't want to force landscape when webview is loaded as
there are other web pages that are used that need to be shown in portrait.
Maybe possibly I forgot something else? I'm stuck.
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if( url.startsWith("http:")) {
return false;
}
//CHANGE INTO LANDSCAPE FOR SIGNATURE
if( url.contains("get-signature.php")) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
return true;
}
if(url.contains("https://www.google.com/maps/")) {
Uri gmmIntentUri = Uri.parse(url);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
}
return true;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity( intent );
return true;
}
});
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/7806a824-09b0-45f9-a587-e0b71e2b5382%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.