Hi everyone in this theater all we're going to go ahead and create another Android application.
So just click on this start in your Android studio project.
And then here for the application name just type in here app 50 free and then click on next and here
choose AP A16 Android 4.1 jellybean for our minimum STK and then click on next.
And then here choose MT activity next and then click on finish.
So as you can see here now our project is actually created.
So let's actually go inside this folder here and then double click and this layout folder.
And then here double click on this activity underlaid mean that examen here and now it's actually designed
to use an interface of our application.
So just selectees hellova that takes you here and then press on delete key on your keyboard.
So now let's actually drag a linearly out vertical as you can see here inside these layouts folder we
have this linearly alphabetical just selected and put it at the center of this relatively held here.
And then let's actually drag an image view into this linearly or Trypticon.
So just select this image view here inside these widgets folder and then drag it into these linearly
and vertical so just put it at the center of this linearly out vertical.
So as you can see here are the gravity of this image view is actually center horizontally.
OK.
So this lay out gravity attributes is going to determine the position of this image view inside its
parent which is this little linearly I swear to god.
So this is gravity here as you can see is actually center horizontal.
So now let's actually assigned a value 200 for the lay out width of this image view here.
So just like this left here inside this property section just assigned a value 200 for the outfit.
And as under-valued 200 for the layout height as you can see here it is 200 ATP.
OK.
Dependent are dependent pixels.
So now as you can see this is our image view.
And now let's actually track some images into our project so as you can see here on my desktop I have
some images.
So I just need to select him and I just need to right click on them and then click on copy 2 items and
in my android studio inside my project structure here I just need to select this triable folder which
is inside this folder here.
So just select this triable for there and right click on it and then click on paste.
So then click on OK.
So as you can see here I have these images here.
Mobile internet at PNB and Voiceprint Internet that P.A. and then let's actually track our Potten into
this linearly out vertical.
So as you can see here inside these widgets folder I have this button here.
OK.
Just select it and put it below this image view here.
And for the lay out which is kind of value match Pallant and double click on it.
And for the text just typing here.
Network
status.
And for the ID just typing here between gets network status OK and then press enter key on your keyboard.
So now the design of our user interface is actually finished.
So let's go back to our main activity over here.
And then let's actually declare some objects.
So the first object that you want to declare here is actually that image view.
So Image view and the name of my image view is going to be I m g.
So let's actually go back to our activity under minute example and W.W. on this imagery as you can see
let's actually assign an ID to this image.
So for the ID just type in here I M G network network type and then press Enter key on your keyboard.
So let's go back to our main activity that double file here.
And for the name of your image you hear just typing here.
I imagine it's for each type and then put a semicolon here at the end of your statement and then it's
actually declared a button object.
So beat button and the name of my object is going to be between.
Get a network status and then put a semicolon at the end of your statement.
So now let's actually go inside and create Meffert in order to actually initialize these objects.
So the first object that I want to initialize is actually IMJ network type.
Assignment operator and then I need to actually trust this object to a image view object find view by
id r that ID.
I m G network type and include a semicolon at the end of your statement.
And and here I need to initialize this BT and get network status object assignment operator and then
here I need to cast this object to a button object find view by ID or that ID that PTEN network status
and then put a semicolon at the end of your statement.
So now lets actually make the spot and listen to the clicks of the user.
So I just need to type in here PTEN and I get network status that set unclick listener.
And then here I need to actually put the context so the context is going to be main activity that this
and and here at the top I need to actually implement the view that unclick less than an interface.
So here I just type in implements view that on click listener.
OK.
And then here inside our class inside our main activity class I just need to type in and click.
So here I am actually all writing the uncloaked method that is actually inside of this like this in
an interface.
OK.
So here whenever the user clicks on this button BT and get and get BT and get networks that is the Smurfette
here is going to be executed.
So lets actually change the name of this argument to view.
And now lets actually create a Java class in our project in order to actually get the network status
OK of our mobile device.
So lets actually click on this package here that is inside of the Java folder or just click on the packet
and then right click on it and the new and then Java class.
So here I just need to select this Java class and click on it.
So for the name just typing here network network info.
So this is the name of my class and it's working for.
And then click on OK.
So as you can see here my class is actually created.
So now I'm going to paste in some lines of code here and then I'm going to explain to you what's going
on here.
So as you can see here these are the lines of code that I actually pasted here.
So when I try to explain to you what's going on here.
So as you can see here I have a method here and the access modifier of this method is public.
This method is actually static so I can actually fair to dismiss it by using the name of this class
dot the name of this method.
OK.
So that's why I put this key word here this is going to be a class if it.
OK.
So static.
And we have this it here.
So this means that this method it is going to return a value of the integer.
So this is the return type OK.
So the return type is integer.
And this this is the name of my Meffert get network status and this method actually accepts an argument
of type context as you can see here.
So now let's actually go inside this method and see what's going on here.
So first of all as you can see I actually created an object of type connectivity manager.
OK connectivity manager.
So what does this mean.
This connectivity manager is actually the class that is defined in Android and here as you can see I
am actually casting this object to a connectivity manager object.
And here I just referred to the name of this context that I receive as an argument from the Smurfit
so context that sets system service.
So here I actually called the Smurfette get system service.
So here I actually created this kind of connectivity manager object in order to get a network in for.
OK so that I can actually sit see that.
What kind of Internet this device is actually uses.
It is actually a type of Wi-Fi or it is actually type Mobot.
So that's why I created this object connectivity manager.
And then I hear context that gets system service so he had to get the system service of connectivity
service OK so that I can actually identify how my how the device is actually connected to the Internet
for wife or for my wife.
So as you can see here get system service and here I referred to the name of this context class as you
can see here this is capital C and then I called this connectivity service here.
This is actually Salt's actually a hold.
They come and.
Q So if you are using your windows machine hold the control key and then click on the connectivity said
service here and now as you can see here I am inside this context that of a file.
And this is actually I think valuable.
OK.
And this is a constant as you can see here.
This is fine on.
And as you can see it holds this value connectivity.
So by actually referring to this variable to this constant as you can see here I can identify that how
the device is actually connected to the Internet and in line 17 as you can see here you referred to
the name of this package.
Android dot net dot net.
14:4.
OK.
I refer to the name of this package and and I called this class and it's well informed.
And then I actually created an object of type network in for assignment operator.
So here I called this connectivity manager that gets active networked inforced.
So by using the sniffer they can actually identify the type of the Internet connection of the device
get at it get active network info.