Hi everyone in this theater I wanna talk about using Faunce in your Android projects.
So just click on this.
Start in your Android studio project and here are for the application name just type in here app 47
and then click on next and here choose AP I-69 Android 4.1 Jelly Bean for your minimum SDK and then
click on next and here choose activity next.
And then here.
Don't change anything.
And then click on finish.
So now as you can see our project is created.
So now it's actually double click on this race folder here and double click on the layout for that and
then double click and this activity underline main that examen.
So as you can see here this is the user interface of our application.
So here we can actually switch between the design and the text.
OK.
So just click on this design tab here and then select the Hello World text and then press until the
key on your keyboard.
So now I want to actually drive a large takes at the center of this relatively out.
So just select these large stakes here and put it at the center of this relatively out here.
And then here are DoubleClick and the stakes for you and for the text just typed in here.
This is text OK.
And for the I'll just type in here takes the value and then press enter key on your keyboard.
So now let's actually go back to our main activity identify here and now I want you to create an object
of type text view so text view takes the value assignment operator.
So here I need to cast this object to a text view object you find view by ID or that ID that takes the
value and then put a semicolon at the end of your statement.
So now I want to actually use a format for my text view.
So here in your web browser I'll just open your web browser.
So as you can see here I open my web browser and in the search bar you can actually put this u r l l
w w w that one thousand and one Fornes that come in this website.
You can actually find some of the fonts and you can actually use them in your project.
So for example I would like this font here.
And then here I can just click on this download here and then it's going to download the default for
me.
OK.
And after downloading the phone's unit to actually unzip this font here and four here for example in
my of this the app on my desktop I have a custom font here as you can see for example this Fauntleroy
Brown.
I have this one.
And inside this folder I have this data to T.F. 48.
OK Fauntleroy Brown that is that TGF.
So this is that phone that I want to use in my project.
So how can I actually use this font in my project.
So first I need to open the Android studio.
So as you can see here this is my android studio.
And here is my project structure.
And here at the top in the section that says Android make sure that you actually choose Android OK for
your project structure and then select this app here.
OK.
And then right.
Right click on it.
OK.
New and then as you can see we have this folder here as you can see folder.
And then here choose these assets folder.
OK.
And now it says creates our souls root for assets which will be included in the APJ EPA became means
the APJ version of our application when we want to actually export our application for Google Play or
other markets.
So this is really important and target source said is Main.
So make sure that you actually hit the target source that is made and here and here it says change the
folder location so don't actually check this checkbox and then click on finish.
So now as you can see I have these assets folder in my app.
OK.
So now I want to actually actually create a directory inside these assets.
So right click on these assets here Neal and then click on directory and enter a new directory name.
So here for that for our directory name just type in here Faunce OK and then click on.
OK.
So here I have this for us here and now on my desktop as you can see I have this Fauntleroy down here
and I have this data T.F. Frontiere.
So I could actually use this phone or I could actually use the phone that.
I actually I have in my download folder as you can see I have this font here so let me actually drag
it on my desktop and double on it.
And now as you can see I have this fall Frontiere.
So I just need to double click on it and he and as you can see I need this or T.F. here this Auty a
font so I have two kinds of fonts.
We have these TGF and this to.
So I can just select both of these fonts here again just select this one and right click on it and then
just click on this copy Fauntleroy Brown that ETF and then here I can just select is Faunce folder this
directory and right click on it and then press on.
Paste here OK and then click on OK.
So here again open this wunderbar folder.
This fall this winter that I actually downloaded from the Internet.
And now I just need to right click on the front here and then click on copy this font wunderbar that
ATF.
And here I just need to select this Fornes for directory inside this as it's folder right click on it
and then click and paste and here click on.
OK.
So I have these fonts in my project.
So how can I use these fonts in my app project.
So now I want to actually I need to actually putting some lines of code in my main activity class.
So here inside our main activity class I want to actually create two objects of type type face because
I have two phones.
OK.
So the first one is of type type face.
Just type in here typeface with capital-T and this typeface is inside the android that graphics package.
OK.
So just selected and press Enter key on your keyboard.
And for the name of this typeface just type in here font name one.
OK.
And put a semicolon here and just declaring these objects here in my main activity and then inside this
uncreate my foot I'm going to instantiate these phones.
And again just typing here type face font name to and put a semicolon at the end of your statement here.
So now I'm going to actually instantiate these typeface objects.
So for the first one name one I just know it refers to the name of this object.
Assignment operator and here I can just type in typeface which capital-T that creates from assets.
OK.
Just select this method.
Here I have some of them if it's here but we need to use the Smif it create from asset because.
Because our form is inside the assets for that.
OK.
Create from assets.
And as you can see here in our project structure I have these assets folder here.
OK.
So here I can just for the first argument I need to refer to the name of our assets.
So I just need to type in here get assets.
So it is going to automatically access these assets folder that that is inside of our app here.
OK.
Good assets and for the second argument we need to actually access the address of our phone inside our
assets here.
OK.
So here we are inside these assets.
So now I can just put into double quotes and I have inside assets for that.
I have these funds.
OK.
So here I am just typing font's.
OK.
Slash and here I can just referred to the name of this front here.
Fauntleroy Brown that T.
So it is very important that you are named for the form that the name of the font here must be the same
as the name of the font here inside this false there.
OK.
So here I need to just type in font font Leroi.
OK.
BROWN
OK.
Dot PTF and then put a semicolon at the end of your statement.
So now I want to actually said that Fornes for this DXi value.
So here I can't just type in the value that said typeface.
And here I need to put an object of type typeface.
So here had this font name von ease of type type face.
So here I can just type in front name one.
So let's actually run our project and see what happens.
So now as you can see our application is running on this emulator and I have this text here and now
as you can see the format of this text view is actually changed to this font.
Leroy Brown.
OK.
So it might actually increase the size of this text.
Here in my code so I can just type in the value that set text size to text size.
And here I can assign for example the value of 50 and now it's actually on our project.
So now you can see that our application is running on the simulator.
And here is our text view of this new font.
So now let's actually go back to our main activity that our fight is.
And this time I want to instantiate this font name to here.
OK.
So here I can just type in font name to assignment operator typeface that's create from assets.
And for the first argument I need to specify the assets so I can just type in get assets and for the
second argument I need to specify the path that is of type string.
So instead of double quotes I can't just type in here fonts and in my project structure as you can see
here I have this Frontiere wunderbar space the more that ATF.
So here I can just put in a slash here and then I can just type in wonder.
Bar space Demel dot OTTF.
And then I need to put a semicolon at the end of my statement.
So now I want to actually change the typeface of this text view to this form to name two.
So I can't just take it for its name too.
So let's run our project here.
So now as you can see our application is running on this emulator and now you can see that the front
of my text is actually changed.
OK.
So let's actually make this application a little more a little bit more exciting.
So here as you can see I have this error and I need to click on this clear cache.
And now let's actually delete this takes you here and here let's actually drag a linearly out vertical
at the center of this relative lay out and here.
Let's actually try a large takes you at the center of this linearly vertical and for the layout we assign
the value match parent and then person enter key on your keyboard.
So now as you can see for the gravity attribute such just select this takes you here.
And let's find the gravity attribute that is related to these takes.
So here as you can see we have this gravity attribute that is going to actually position the children
of this takes you OK.
So I have this text inside this text view.
So now I want to actually position this text at the center of this text view.
So I need to work on this gravity attribute as you can see here.
I have this gravity attribute and here I just need to check this checkbox for this center.
OK center attribute.
And now as you can see this text is at the center of this text view.