I have an Activity
class that have a DrawerLayout
. That layout shows a list in Drawer and let user to switch between fragments
. In these Fragments
, there are some URLs and when user clicsk on that, a WebviewFragment
would be shown. However, I don't want to show the DrawerLayout
in the WebViewFragment
. Instead, I would prefer user would being redirected to previous Fragment
.
Is there any way for me to show/hide the DrawerLayout
depends on what the current Fragment
is?
I try to call mDrawerLayout.setVisibility(View.GONE
), but it seems that it is not complete. At least the ActionBar
icon is still the drawer icon.
Why not open a new Activity that has only a WebView as its content instead? Then the user will have to press the back button to go back to the Activity with the DrawerLayout, and then there will be no problems.
Alternatively, you don't have to have such an activity yourself, you can let Android find a browser for them to open instead using this code:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("HTTP_URL_GOES_HERE"));
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With