‫Hello, my friends, in this video, we are going to continue with the face detection application and
‫we will write the last method, show detection and we will pass into the parameters three variables
‫the title of type string, the builder of type string builder and the boolean, which is of type or
‫success as if type boolean.
‫Now we will check if success this will show this method.
‫Its main role is to show the result of Firebase ML Detection and in text view.
‫So if success is equal to true, then what we will do?
‫We will put a text view dot set text to null.
‫Then we are going to put a gain set movement method to new scrolling movement method and we check if
‫builder dot length builder dot length does not equal to zero.
‫What we will do.
‫We will append the text view with the builder.
‫So text of your dot append builder.
‫And if a title the substring we are going to substring the spaces.
‫Okay, so what we'll do.
‫We will substring zero at the at beginning the beginning index at zero four from the start of the string.
‫We will append till the index of the empty space.
‫So index of the empty space.
‫So we will start from the beginning of a text and we will stop until the title at index space if there
‫is a space.
‫So for example, what we will what we are going to do.
‫I know it may be confusing for you if I type hello my friends and I execute this method on this string,
‫it will start from here, from the string index equal to zero, and it will stop until it sees an empty
‫space.
‫So this is the this is the start and this is the end and it will substring.
‫So it will took only hello and substring it and we will check if it is equal to OCR equals to equals
‫to or equals.
‫Ignore KS to OCR this OCR another to another string.
‫Then what we will do hold the text to copy it we will put text view dot append.
‫Hold, hold.
‫Hold that text to copy it.
‫LS what we will do?
‫We will protect you, dot.
‫Append, append, hold.
‫Hold the text to copy it.
‫Okay.
‫This is just for checking if the string is having an OCR and now the text view dot set on long click
‫listener.
‫If the user click on the on the text view by for a long time.
‫So new on long click listener what we will make.
‫We will create a clipboard in order to allow the user to copy it to the clipboard so you can copy that
‫text.
‫So when we scan the image or for an OCR or whatever we want or copy for the face detection as our app,
‫we need to allow the user to copy the text of our results.
‫So how to allow it by by using the clipboard.
‫So clipboard, clipboard
‫instance equal to I will initialize it and cast it as a clipboard manager.
‫Get system service context.
‫Context.
‫Dot Clipboard service.
‫Now.
‫Clip, data clip.
‫Equal to help us enter the import package.
‫Plus enter to import the package clip to clip a data dot new plain text title and the builder.
‫So these are the two parameters that we passed the clip and clip board manager, the set primary clip
‫to the clip.
‫So I have created a clip manager instance, I create a clip data instance and I will connect them to
‫that to each other by using the clipboard to set primary clip to clip return.
‫True, because it's a boolean function returning type.
‫Okay.
‫Now what we will do here.
‫We start by if we need to close by else.
‫Text of you if everything is failed.
‫So what we will do?
‫Append Title thought substring zero title of index of if there is a space and the here we would put
‫detector didn't find anything or failed.
‫Fail to find anything.
‫Okay.
‫This is very simple.
‫Now, we are going to check for again for the F.
‫So this is the F.
‫If we hover the mouse here and we click on this, it it is for the f success.
‫So here I need to put ls f l safe success equal equal to false.
‫Then what we will do, we are going to put text view dot set text to null and text view dot set movement
‫method to new scrolling movement method and text view dot append belt.
‫In this case, we have finished our application on facing face detection application and let's clean
‫the project and then let's run our application and test it.
‫And then we are going to fix some error if we if they are present.