Android Browser – WebView – Complete Tutorial Series Part 2 – Creating Back, Forward, Reload Buttons

Hi guys what’s going on welcome back to
this brand new Android studio tutorial and today in this video I’m gonna show
you that how to add a menu icons inside the action bar so in the last video we
have been developing this Android app which has a webview we have a progress
bar we have an image view and things like that so in this video as I said I’m
just going to show you that how to create a menu items and add it inside
this action bar so let’s get started I’m just going to the Android studio there
is nothing that we have to do inside this layout so just closing that now we
have the main activity so first off we need to create a menu item so that I’m
just going to right click on this rust folder will send four resources then
going to new then we have to create a folder that is a new directory then that
can be named as menu then click on the ok now we have a folder called a menu
just right-click then we have to go to new the manual resource file and this
time I just want to name it a super underscore minimum then clicking on the
ok now we have the menu now what we need to do is that I’m just going to add some
menu items into this menu so adding it one by one so I’m adding one more item
now we have three items now just going to text what we need to do is that we
have to separate each of that now adding the title for this menu item oops
title is already there so we need to add icon so that can be I can then just go
and right click on this drawable folder go to new then just go and you need to
select the vector I said then click on this that’s literally a block inside
Android studio anyway what we need is simply search for arrow and this way we
will getting this arrows so we need to this and this so just selecting the
first one clicking okay next finish now again right click new then I’m just
going to select a vector accept and this time we need the forward ok that’s it
click on the hockey finish that’s it now go to the draw ball now we have these
two at all what I’m going to do is that I’m going to switch it into white color
and same I play to this one now we how avoid arrows now we need to add the icon
so that can be at all left I can then add all right now I want to add a chess
you know show a section always just copying this line pasting it here now as
you can see we got something like this ok now finally what we need to do is
that I’m just adding this for assemble the third one is not actually required
in my case because this is a sample app maybe like you can just give it as a
little reload then if you want then you can do that so and while using reload
maybe let me show you so I’m just going to click on this trouble then selecting
vector I said and they will be having real or maybe like the search for no
refresh yeah we have the refresh selecting there finish changing it into
white and adding the icon then refresh and a short section maybe like always
but it’s not suggested to go with more than two item on the action bar and it’s
always better to you choose maybe like you know this drop-down menu so you can
just call it as refresh and this into forward and this backward now we have to
add the IDs so menu underscore back and this is menu refresh now we
have a menu which is completely done now we need to just go and close that now we
have to create two methods just type one option menu option option menu and we
also need one option on something like you know option item selector that is
for the menu item selecting now inside that we have to create a menu in flatter
in order to inflate that manual minimum layer file so I just wanna name it as a
mini platter itself then get meadow in platter so this way we can inflate that
layout into this one create option menu let’s go to the menu I can see so now
what we need to do is that we have the menu in flatter which is this variable
name of the in platter then don’t in flat and we have a layout which is our
dog menu dot super meadow and then we have to add a variable name of the
middle which is menu now we got the menu inside the one create option menu now we
need to add the item click listener each for each of the item so now I’m just
going to create a switch so that we can select one by one so I’m just going to
add it as item of item then get item ID okay now inside the switch we need to
create we need to get the menu IDs and add the action according to the menu IDs
so it very using the switch we have the case so our door ID dot then menu bag
which is the first menu and when it is clicker we need to go back so that we
can simply call the method that we just created from the last video one back
presser so one back presser and that method will be called now we need to
break that line or may break that menu now we need to add a second menu so case
ordered ID dot menu forward just breaking there then
finally be how the main case which is out dog
ID dot menu refresh and same as the second one I’m just going to break here
now inside the second menu we need to just create another method so I’m just
going to give it a spray wet then void then on for processor so this is a
custom method that I’m going to create I’m using the same matter as we have
done in the one back processor just creating an if and super-boob view then
you can go forward and if it can then go forward then go forward else you can
simply just show a toast now we have to call the method in the second menu so on
forward for processor now we have the Refresh in the case of the menu refresh
we just need to add super book view then real or that’s enough for this now
everything is done we have things actually what we require is hero now
some of the people may asking that how to add a refresh for the book view at a
particular time in the well so for those people I will be making the next video
about a refreshing swipe refreshing the book view and it things like that so now
we have completed our work let’s go and try that inside the Android app so
gradual is building let’s wait until that get done now it’s installing and
it’s opening now as you can see we have the buttons that we added in the middle
we have the buttons inside the action bar we have the back button we have the
forward button we have this close sorry the refresh button so I’m just going to
search something inside the book view so seven speakers even I was lacking this
one now I’m in the second page let’s go and tried the back button and blam it’s
fucking perfect to be out in the back page let’s go into the forward page now
we are in the forward page I’m just going to reload this page let’s see what
happened and blam it’s reloading and everything is done so that’s for this
video in the next video we’ll be adding the swipe to refresh for this book view
so hope you guys enjoy watching this video and if you do hit that like button
and that’s really means a lot for me and anyway if you are new to the channel
then don’t forget to hit that subscribe button as always thanks for watching and
hope to see you in my next video peace out you

34 thoughts on “Android Browser – WebView – Complete Tutorial Series Part 2 – Creating Back, Forward, Reload Buttons

  1. Hello sir, when I open my project and refresh got the error access is denied. But yesterday is success run then what's problem. Please help me

  2. Hey Sabith , My new App Gone Live Today . I Feel Good if you check it out.Thank you in Advance

  3. Make a tutorial on picasso plz.. Full form upload image in picasso to showing in image view…… Plz make it fast….. By the way this video is awesome

  4. Where is 3 part i think you upload daily parts….. And also the wallpaper app now 3 months are waiting…… Plz upload daily videos plz….

  5. Heyi i have an important question for u. Well how much time it will take to learn java so that i can get started with programming an app? Can i learn from youtube videos properly? Is it easy to learn within a month? And yes.. what is this kotlin🤔😢?

  6. hi, can you use a samsung s3 camera to detect motion and automatically refresh a page? I am using a that samaung phone for home automation dashboard and trying to make it automatically refresh when motion detected. Thanks In Advance

  7. hii how to add forward button in fragment because menu button is in activity but WebView in fragment so how i do that

Leave a Reply

Your email address will not be published. Required fields are marked *