Hi everyone in this theater we're going to go ahead and create another Android application.
So just click on this.
Start in your Android studio project and then for the application name just type in here app furtively
and then click on next year choose AP A16 Android 4.1 Jelly Bean next and Blancher activity next and
then click on finish.
Now let's actually delete this hello takes you here and then our present delete key on your keyboard.
Now let's actually double click on the rest folder here.
Lay out and then activity underline made that example.
And then here selectees filleting action button and then press on the right here on your keyboard.
OK.
So now let's actually go back inside this content underline that example.
And now let's actually click on this.
It takes tap here.
OK.
And here is actually the change.
These are relatively out here to takes to you.
OK.
And then here as you can see if you have text you here inside these texts.
So in this tutorial we want to actually create a simple application.
OK.
So let's actually go to the Android documentation as you can see we have this audio adapter here.
OK.
And this area adapter or inherits all of the features and behaviors of this of this base after class
and implements the filter table interface and this fiend spinner adapter.
So as you can see here it says a concrete base adapter that is backed by an array of arbitrary objects.
OK.
By default this class expects that the provided resource ID references on a single text view.
OK.
However the text view is referenced.
OK.
It will be filled with the string of each object in the array.
OK you can add the lists or arrays of custom objects.
OK.
So that's why we actually change this relatively And here are two text view.
OK because we want to actually look at our array of objects into this text view here.
OK.
So as you can see here inside this design type instead instead of a relatively out we have a text view.
OK.
So.
Now let's actually go back and say this main activity class here.
OK.
And then let's actually delete these lines of quote that are related to the Options menu.
OK.
And then delete this block of code that is related to the floating action button.
And now we can actually put in our own code here.
So now inside of this main activity class I'm going to put in Assignment some lines of code and then
I'm going to actually explain to you what's going on here.
So as you can see here we have an array of string values here.
OK.
So he had as he can see the name of our array is called names.
And I actually assign these values to my Aure as you can see here.
OK.
So here I in line 12 I declared an object of type 3 adapter.
OK.
And as you can see here this object actually accepts a values of type string.
OK.
So now we want to actually create a list view.
OK.
So instead of extending from the African past activity this time we want to actually extend from these
a list activity class.
OK so what is this list activity class.
Let's actually go back to the Android documentation.
As you can see here we have this list activity class here and in your web browser you can't just type
in RL and you will be guided to this page.
So here as you can see the list actually with the class actually inherits all of the features and behaviors
that are inside of this activity class.
OK.
So as you can see here now it says an activity that displays a list of items by binding to a data source
such as an array.
OK.
So we have an array in our project as you can see here.
This is the.
OK.
So to our data source such as an array or cursor and exposes our event handlers.
When the user selects an item OK list activity hosts a list view object.
OK that can be bound to different data sources.
Typically either an array or the cursor hold the inquiry results.
OK.
So let's actually go back to the Android studio here.
As you can see there's actually as you can see we cannot any more call this method as you can see here.
So let's actually did it this method here and it's actually delete this object and we don't want to
actually call this sets content view as you can see here are that lay out that activity made here anymore
because this is what is actually showing the layout to the user.
OK.
So we don't want to call the Smurfette OK because if you have a text view inside this content underline
main that example OK.
So we don't want to actually call this our second interview here.
OK.
Now I want to actually instantiate this adapter object as you can see here that I actually declared
in line 11.
So I want to instantiate this object inside this uncreate method.
As you can see here.
OK.
So I'm going to paste this line of code here and then I'm going to explain to you what's going on here.
So as you can see here this is the line of code that actually pasted here after.
So I actually referred to the name of this adapter object.
OK.
Assignment operator new.
OK.
Arey adapter.
OK.
As you can see inside these tanks I put in this string here.
OK.
And then inside the Prentice's I need to actually assign somebody else first of all I need to actually
specify the context.
OK.
So the context is this class.
Ok main activity that this.
And then I need to actually specify the view that I want to actually put in my art objects too.
OK.
So as you can see here this is the view.
OK I want to actually put these are our values to this view OK or else that content me k content underline
meaning.
And these are the values.
Calls names as you can see here I actually referred to the name of this array.
OK calls names.
These are the values that I want to actually put in this view.
I want to actually call a method that we actually inherit from this list activity class.
So I can just type in here set list adapter as you can see here we have this Mfat So if we actually
hold the command key and click on this method here for Windows users you can actually hold the control
key and then click on dismiss it.
OK.
So as you can see here this is the Meffert that is inside of this list activity that Java class.
OK.
Set list that after and this if it actually exits an argument of type list adapter.
OK adapter.
So let's actually go back and say this main activity that Joe right here.
And as you can see here we have this adapter object here as you can see here every adapter and we can
actually put this adapter here.
OK.
So as you can see here now let's actually run our project and see what happens.
OK.
So as you can see here now our application is running on the simulator here and now we can see these
values here.
OK.
Android developer of course are U.S. developers of course and undervalues.
OK.
So if you have a simple list view in our application.
So now I want to actually do something up when the user clicks on one of these items inside of this
list list.
OK.
So for that purpose we need to actually implement an interface.
So here just typing implements our adapter view.
OK.
Dot on item click listener.
OK.
We need to actually implement this on item calculus and in interface as you can see here and here inside
of these uncreate MF'er First of all let's actually create an object of type list view.
So they've been here at least we do.
And the name of our object is LS The View assignment operator and and here I want to actually call MFL
that we actually inherit from this list activity class.
So here after the assignment operator just type in here gets list view.
So as you can see here this method is going to actually get the list view of our application and that
is going to actually assign that view to this object elative you.
So if we actually hold the command key and press on this method method here as you can see.
So this method is actually inside this list activity the Java file and this is our method.
OK.
So let's go back inside this main activity there job of file here.
And after this line of code in line 25 this actually refers to the name of this object.
LS The View that sits on item as you can see here sits an item.
Click listen here and here inside of these Apprentice's you need to actually putting a value of type
on item click listener.
So because this main activity class is actually implementing this and after that an item click listener
interface as you can see here.
So there is an ease or relationship between these two or between these main activity class and these
are items like listener interface.
So here I can just typing a main activity dot this.
OK here I am specifying that this main activity that class is going to be the listener.
OK.
And then after the ending curly brace of these uncreate Smurfette here as you can see we need to actually
implement as you can see here.
It says classman activity must either be declared abstract or implement abstract method on item click
here.
As you can see.
So here are after the ending calibrates of this uncreate Meffert and inside of this main activity class
let's actually override this method.
All right click here.
As you can see here and then our person enter key on your keyboard.