Learn Android development with Kotlin and master the use of Intents to create seamless interactions between activities and components. In this video, we'll dive into the world of Android development using Kotlin, focusing on Intents and their role in building robust and efficient Android apps. Whether you're a beginner or an experienced developer, this video will provide you with the knowledge and skills needed to take your Android development skills to the next level. With Kotlin as our programming language of choice, we'll explore the fundamentals of Intents, including how to create, send, and receive them, as well as how to use them to share data between activities and components. By the end of this video, you'll have a deep understanding of Intents and how to use them to build complex and interactive Android apps.
Yo, what's up guys? Assalamualaikum. Welcome to this tutorial. In this tutorial, we are going to be creating our first intent.
So let's get started. First thing first, we are going to create another activity.
So we're going to go to Java folder, right-click in here, and we are going to create
activity and that activity will be empty activity. Now this empty activity will be named as
second activity and
let's finish this.
Now let's go to code and convert the Java file to call them.
This is done.
Now we are going to go to the second activity and in here, basically we're going to have a text view
which will match the parent, match the parent and it will have
text
second activity
and it will have the text size
as 50sp.
Now we're going to go to the main activity
the XML file and in here we're going to say button
and obviously width will be match parent and the height will be wrap content.
Now we need the text. Text will be click me.
The last thing we need is ID. So we're going to say btn
click me, sorry, click me.
Now we come back in here.
So the first thing we're going to do is we're going to say btn click me dot set on click listener.
Okay.
Now in here, I'm going to say var
or val better
intent is equal to
intent
and this intent takes parameter this
and also the file which you want to open or the activity that you want to open. The activity I want to open is called
second activity, second activity
and double colon java class or class. It's uh, I'm going to select class dot java
and in here
I'm going to say start activity, start activity and the intent in here.
So what is happening? The first thing I'm doing is I'm saying when I click on the button this code should run.
So the second line says
I'm creating an intent whose context is this and it will open up the second activity java file.
But if you take this
it will not work fine. So you need to have the java in here.
After that start activity basically I am saying start the uh,
intent
whose value is this. So I want you to start this intent.
Let us run this.
Now if I click on this as you can see the second activity opens up.
Now, how about I click uh, I create a button which will take us to the first activity. We're going to copy this.
We're going to go to the second activity and we're going to say we I need to create a button.
So button
button will have wrap content and wrap content
or maybe match parent wrap content. So we're going to say match parent width
and wrap content.
It will be above this
and it will have id
for now btn1.
Now in here I'm going to declare orientation that is uh vertical
and in here I'm going to say
text
uh go to main
and in the second activity I'm going to paste my code
the same code
which I got from here actually I think there is a mistake.
So I'm going to paste this code
and instead of button click me I'm going to say
btn1
dot set on click listener instead of second activity. We're going to say main activity. So we're going to be opening
main activity
and we're going to take out these
Now let's run this
Now let's click on this
It takes us to the second activity. If we click on this it takes us back to the first activity
Now in here you see nothing because uh, if you go to back to second activity
and click on this
This thing is actually not in the region. There is a problem in this that's why
uh, it's not in the region because the width is zero we can say
Match parent in here so it will appear
Now as you can see second activity appears and if I do, uh this again
I mean run this again
This is the first activity main activity. This is the second activity. We go back to the main activity
This is the second activity. Okay guys, that was all and I'll see you in the next tutorial. Bye. Bye
Yo, what's up guys? Assalamualaikum. Welcome to first intense tutorial and in this tutorial
We're going to be understanding. What is an intent?
An intent basically I n t e n t is basically similar to web url
url
And that is like google.com, you know google.com in the address bar and you go to google.com
Okay
Similarly an intent is an address
It's an address which tells the android to open up
a particular page
Or a particular, uh, uh app
Or a particular activity
Whatever you want to call it. So it opens something else, but it is more powerful than you think
But in simple words intent is used to open something at a specific address
But if you don't have that address
Then it gives you the softwares or the apps that can open those programs or those files
Okay, now i'll be creating a new project, uh, if you don't know how to create one you can follow me
But if you know, you don't need to follow or you don't need to complete this video. You can just end it here
Okay, guys
So let's get started. I'm going to create a new project
And i'm going to call it
Intent course
one
And i'll use the api 19 then next and then empty activity and next
And then again finish
Now go to tools and kotlin and in here configure kotlin in your project and android with griddle
and all the modules
Now let us add the extensions plugin we're going to say apply
plugin
Here kotlin
minus android
minus extensions
And let us sync again
Come back in here double shift and in here we're gonna say convert
kotlin
Java file to kotlin. Sorry, and we have it in kotlin. Okay guys, that was all for this drill and i'll see you in the next
drill. Bye. Bye
Yo, what's up guys? Assalamualaikum. Welcome to today's tutorial in this video
We are going to be learning how can we send data from one activity to another using intent?
So let's get started
In here we're going to say intent
Intent the one we created in the previous video this one intent don't
put extra
Basically means I want to add extra things with this. What do you want to add?
The first thing it asks is what it asks a string and this string is basically a key
So in here we're going to say my name
So this is a name of the value
Now we have this name and if I put comma and add the value that that is
I'll leave for this so
This identifies ali. So when I go to the other side if I ask it to bring me the data for my name
It will bring me ali. Okay
Now if I come to the second activity in here and in this part, I am going to say
Intent
Okay, so extra okay get string
And in this get string it asks for key and in here i'm going to give a key. What key is it?
It's my name, right? I'm gonna put my name in here
And i'm gonna render
It won't do anything by the way, because we didn't ask it what to do with it. Let's ask it to put it in
Text so let's go to activity two and let's give it
id
id and id is
txt activity
Two
And let's come back
And in here we're going to say txt activity two dot set text
And that's text is equal to this value in here
And now let us try this again
Now let's click on this
As you can see it displays ali in here and if I come back in here in this place
In here it is displaying second activity, but when I click on the button
In here I send data with extra data with the
id you can say with the id of my name and its value is
Similarly, you can add as much data as you want
So I can say intent
Now I want to send this data to the second activity obviously in this activity I have to receive this
So what i'll do is i'll come from here
I'll say
Now
one thing to note that
Uh while in editing the video I came across this problem that I didn't put
double quote in here
But this put extra only accepts the string value. So make sure you have the string values
So these are string values ali 30 instructor
Okay, guys, that was all and i'll see you in the next tutorial. Bye. Bye
Yo, what's up guys assalamualaikum welcome to this tutorial in this tutorial we are going to be learning about something called
start activity for result basically it means
Starting another activity doesn't have to be one way according to official documents of android studio
They say you can also start another activity and receive the result back
So basically means if you start an activity you should have a power to get something from that activity back
And to risk to do that we use something called start activity per result. Let's take an example
I'll go to my mobile phone. This is my mobile phone and this is a emo plus that I use to call to my country
Okay, so i'll tab on contact and I get list of contacts in here
I'll choose the first one and you will observe something that when I choose something I get some results back from there
So again, let me go in here and let me choose ayman and I get his number back in here
So this is really really useful and is really used in a lot of applications out there
Okay, so let us come back in here and let us see how it's going to work. So
We're going to say start activity. How do you start activity you basically?
Start the activity by saying new intent and basically creating an intent and saying start activity for result
For that you need to have the intent and the
Request code. So let's actually create one. I'm in the main section in here in the main body of mine. I'm gonna say
Uh when I click on the button, so obviously btn
And click me
So it's here btn. Click me
I'm going to say dot set on click listener set on click listener
And inside in here
Boom let's take a bit of distance. Okay inside in here. I'm going to say
more intent
Of type intent which you can
Forget about this. You can use just is equal to intent
No problem. And in here we'll use this and obviously the second activity where we are going second activity
Uh colon colon and the java dot class and here we can just start the activity
But we can't say start activity. We'll say start activity for result which takes the intent and the request code
Okay
So first thing it will take is intent as normal start activity
The second thing it will take is the request code and the request code can be anything from zero to any number
Okay
So if you have two intents, let us suppose I have two intents
and
This intent needs to be of
Of code one request code one why because the request codes are used to classify one intent from another
If you have multiple intents in your activity or uh in your program
And this can be any number you can have 1000 rather than zero
But it should be different than the other activities or other intents. Sorry and other intents, uh request code
So basically this is it. This is it. This is all
Uh now in the second part, this is where the fun starts
Okay, so I have my second uh button one that is this button in here. I have it. Uh
Open what I need to do is first thing i'll create an intent an empty intent
So i'm going to say var intent is equal to intent and that is all so I have an active and empty intent
Now I need to put something inside right? So i'm going to say intent
Dot put extra put extra and the name will be
Uh txt and the value will be uh, this is my text right text
and
We're going to say set results in here and set result takes two parameters first parameter is
Result code and result code means result. Okay or result cancelled
So obviously if the result is okay means it is working correctly then
Uh, the second thing is the intent the data that we want to send that is all
And you can finish in here
That's all
Now what i'm going to do is i'm going to come back number one
You call the second activity number two
If you have some data to send back to the first activity, you will uh put it in the second activity
the last thing is that you need to
Uh have something called on activity result
so
On activity return the result. I don't remember correctly. So ctrl o so i'm going to say
on activity
result
And this will have a couple of things to do with this. I'll have a couple of things to do with this
number one
When there is something back first of all, we'll check if the result request code request code
Is equal to the request code that is in here
Which is zero, right?
Which is 1000 sorry. So if the request code is 1000
Is equal to 1000
means we are dealing with the
Intent that we have and we need to check if the request code result code
is equal to
result, okay
then
The first thing is the request code which we dealt with this we're checking if the request code is correct
Second thing we are checking if the result is correct third thing
Now we are going to display the data the way to display the data basically
Is you say a var?
result or
return data returned data
And in here you're going to say
result
Sorry data
dot get string
get string
uh by
Extra sorry not by extra just extra and in here you need the name of the string that you had in there
So if I come back, it's called txt. So here you need to say txt
And you need to put the value inside the uh text field that you have in here
So i'm going to say txt result code dot set text not instead of text i'm going to say
returned data
And that is all but if I select something, uh, if the code is not right
You can just specify the else condition too in here. You can say else if
request code
Sorry result
code is equal to
result canceled
Then you can say
There was a problem. For example, you can say txt
I'm gonna just get this up a bit. Yes
txt result code dot set text is equal to there was a problem
Now the moment of truth. Let us come back in here and do something before we do something. We need uh,
Null, we need to tell it that the value can be null no problem
Which it shouldn't but let us suppose it can be null
Now i'll click on the click me
And as you can see I go to the second activity and now in the second activity if I click on go to main
Then first thing first, it will go back to main. I didn't specify in here go back to main
but because it knows that it needs to go back to main because it is an intent which is
Supposed to return something then it will go back to main by itself. So if I click on this
Oh
Come on this guys. So this is my text and if I come in here see this is my text
So it is returning back something from the second activity towards the first activity
Okay, guys that was all for this trail and i'll see you in the next trail. Bye. Bye
Yo, what's up guys? I'm adi come welcome to this tutorial and in this tutorial we are going to be learning about the implicit intent
So let's get started. First of all, what is implicit intent?
Well implicit intent is basically another intent the intent we know like it will
Take us to some other activity
or some other
app
This is intent
Now this intent in here does work. For example, I want to uh,
Send a message. So i'm going to say send a message. For example, let's suppose I give some command like this
I say I want to send message
And this command in here
Will go to the android function android or os you can say whatever
Android system and the android will say there is someone who wants to send message. Is there any app?
It's it's gonna send the uh request to all the apps
It's gonna say is there any app who can accept this? Uh request for example, there is a messenger app
And there is for example a youtube app
Okay
And let's uh, let's suppose contacts app or messages app
And lastly whatever app
you can say uh
A game basically maybe so there is a game app now out of these this will receive
The request and it will say yeah, I can accept messages because messenger can send and receive messages
So messenger will accept the request
Okay, then youtube won't accept the request
Uh, the messages app will also accept the request
So but the game will not accept the request. So those who accept the request will be listed like this
So this is the messenger and this is the message app
So this is how implicit intent works
Let us look at a simple example
Let me go to my browser in here and i'll search for
the infinix
Now in here i'm going to view my mobile phone
And let us go to for example whatsapp
It will require password
Now in this whatsapp, let us suppose
I have a message in here with the picture
So what i'm going to do is I want to share this picture
Now the request for sharing will go to all the apps and those apps who can share this picture
Will accept the request
And come into the list. So these are the
apps which can
Do something with the picture which can share the picture the messenger the whatsapp the email gmail
Evernote maps and so on so forth. These apps received the
Request and now they are saying we can do something with this picture
So they received they accepted the invitation
And this is how it works and after that it's up to you
Whatever you want to do. For example, if you want to send it, uh through messenger, you can choose messenger
And as you can see now, you can send it to anyone you want
Easy, right?
Okay, guys, that was all for this trail and i'll see you in the next trail. Bye. Bye
Yo, what's up guys? I am Aya you can welcome to this tutorial and in this tutorial
We are going to be taking a simple intent example on implicit intent. So let us get started
So first of all, let us look at this this is uh built an implicit intent from developers.android.com
Okay. So first thing you see is that it says uri number uri.parse and telephone and this number in here
Uri basically is somewhat like a link. So it is saying that I have this link. I have this uh,
Link in here
And I want to parse I want to understand this link
So, how do I understand this link or basically I want to uh
Decode this link so that we can understand. Uh, where does it take or where should it take or what should it do?
Okay, so you don't have to understand this but basically for example if I have a uri if I say
uh, first of all btn1
dot set onto listener
And in here, let us suppose I have a uri
var uri
That is equal to uri dot parse
And in here, let us suppose I write http
colon
slash slash
G-double-o-g-l-e dot com google.com, right?
Now I want to view this what can I do? Well, obviously I can say in here that intent
Or I can just directly say start activity
In this activity, I will say intent
In the previous intent we had we had this for example, we would say this the main activity something like that
But this time we have to say intent
dot action
view
So let us suppose I select action view and what do you want to view? I want to view this uri
This uri
So and uh action view will try to view show this to you show whatever you put in here to you now
this url
Is understandable by us, but computer will uh, uh
I mean decode this and try to understand which apps can accept this and then this in send a request to those apps
So let me try this i'm going to click on this and open the infinix
Let's wait for couple of seconds
Now if I click on this it will try to go to google.com let me click on this
It says you want to open google.com
Okay, these are the apps that can open google.com. So in here when it saw it's uh, it saw http
It knew that this url
Needs to or this uri needs to go with the browsers. That's all
Similarly as you can see first of all, let us try this. Obviously, it's not a big deal
Let's try this after that. We'll try the telephone one, which we saw
So as you can see we went to google.com now for the telephone one. Nothing special
If I say telephone
Uh zero five nine four five four three two three seven and let us try
Configure using it with action view so it will try to view this in any possible way
Now let us uh come in here and click
As you can see it
Uh, try it tried to show you and it when it went to url it knew that you need the telephone version
So in here instead of dial you can use telephone, by the way
So in action dial you can say action action view. So for example if I say dial in here
action dial
And let us try this one
And let us click on this it's same nothing different
Okay, so it's all the same now this action dial or action viewed the action will try to solve it as
Uh as much as it can for example, if you take the example of geo as you can see in here
We have something called geo location. Uh, so this geo
Let's copy this action view
It's again action view so we're going to copy this
And we're going to put it in here
Now this location. This is a location now a uri will uh
Split this in couple of parts
The first thing it sees is a geo means then it uh sends a request and sees which one accepts geo and that
app will
Uh be used to show this so in here we need to say
View
Now let's run this
Now let's click on this
And as you can see I have google maps and I have uber which can take the geo, uh, for example
Whatever geo location
So they can uh, take the geo uri maybe
And that's why they accepted the request for the geo and said that we are the ones who will
Be able to or who work with uh the geo locations. So
We can select any of this for example this one. So if I select the um
google
maps
Now it shows me the correct location. I don't know which uh from where where is this location. It's it's google text or whatever. So
So this is how you use the intern dial and intent view
So that was all for this tutorial and i'll see you in the next tutorial. Bye. Bye
Yo, what's up guys? I'm sam. I welcome to this tutorial and in this tutorial
We are going to be learning how can we use intent to send emails?
So let us get started. First of all, let us go to our browser and in here let us search for something called common
intents
and in here the first thing you
Find is common intents from android developers
So in here, uh, don't ask
We're gonna go for email
And from email we see couple of things in the action section
We have action send to action send and action send multiple
So the one we are going to be using is action the same tool because we are not going to be using any attachment
And before that let us go up in there
At the start and let us look at maps in here
Remember the last time I used uh geo well, I got it from here because in this document it tells you uh,
The data uri structure or scheme using which you understand how the uri will look like
Okay. Now let us go back to email and this is the one we are going to be using
So let us get started and i'll show you step by step how it is going to work
So the first thing we are going to do is we are going to say var intent is equal to intent
And in this intent I will have
uh intent
or action
Send two because the send has one attachment and send multiple has
Two, uh two or more attachments. So the same two has no attachment
The first thing okay. The second thing is intent
dot
set
uh type
Now the set type has uh this mime
This thing here you can either use text or plain or this thing in here
I'm going to use this one so that you can see how it's going to work. So i'm going to use this one
Now after this we need uh extras so we're going to say intent
dot
Uh put extra put extra
In here. The first thing is a mail. So we're going to say
intent dot extra
Email
And the value of the email for now we're going to say here say for all
I'm email.com
And then we need the subject we are going to say intent dot put extra and in here we're going to say intent
dot subject
And the value will be uh, i'm hungry
Not really but
I'm hungry. This is a subject intent dot put extra and in here we're going to say intent dot
uh extra text
And this is the text text means the body so in here we're going to say, uh, i'm
Really hungry
Please
Uh, send me some food well, it's just a joke
Oh, I don't like it, but okay we have already written it so now in here we're gonna write last thing
That is this thing in here. We're gonna copy this and we're gonna write it in here
Basically, it's gonna check if there is uh, any application that can handle this or not if there isn't any we can say else
Now let us play this and see whether it works or not and I am sure that it won't work but still let us try this
Now if I click on this
I see that there is no application compatible. Why is that that is because of uh,
The data type or the data basically set data. We didn't set any data and we need to set data
So let us come and send data set data or basically I can copy it from here
And I can paste it here
And now let us try this
Now if I click on this as you can see, uh the
Gmail application opens up and we have our subject and we have our boy
but the problem is with the
Tool section and that is the email address. What is the problem with that?
Well, the problem is simple all you need to do is create a var and you can call it for example email
And you can say is equal to array all
And here you put the emails. For example, the first email i'm going to put is you can say for all at gmail.com
Maybe there is another email that I want to include that is uh test at gmail.com
So I have two emails and this requires actually the data type it requires is a
Array data type. That's why we have to give it already
Now if you try this
And click on this
And come back
Now if you click on this nothing happens, right? So let us come in here and discard this
Now if I click back
As you can see the emails are being added, okay guys that was all for this tutorial and i'll see you in the next show
Bye. Bye
Yo, what's up guys?
Assalamu alaikum welcome to this tutorial and in this tutorial we are going to be learning
How can we create a place picker such as this if I click on this?
I'll get a place picker in here using which I can pick a place I can search a place and select that location
And once I have selected that location selected that location, I mean I can just uh, click on the select location
And i'll get that location
For example, if I click on select location now, I get this this coordinate in here and i'll I can say select
And as you can see I get the latitude and the longitude in here
Uh, this is really really useful while creating maps. So let's get started
The first thing you need to do is go to console
console
dot developers.google.com
Once you're in here create an empty project from here any project will work
Uh, you can click in here and create a new project
And just click on create
And after you have created all you need to do is go to a library
Let's go to google android maps api and enable this
And then let us go to library again
And let's click on google places api because the api that we are going to be using for this is from the
Places api and as you can see the places api has already been
uh
Enabled so all we need to do is go back in here
And go to credentials and create credentials and api key
And it's going to generate us an api key. So first of all, let's copy this
Now the second thing is you need to go to project and go to java and over here
You need to right click and go to new
And then go to google and create on click on google maps
Activity once you click on google maps activity, you will be redirected to this page in here
In this page, all you need to do is just paste the key that we have just created
As you can see in here is my key
And that is all
This is the first step that you need to follow. Now. The second step is that you need to go to google
search for google
play services
apis
Api, maybe
Once you are here, you need to click on the first link that you get
And from here you need to go down and here you see a lot of apis in here
The one we want is the play services
So
Places, sorry. This is the google places. So we copy this
Uh go to our griddle. Let me close this. Let me close this and let us go in here
and
Just write it like this you say implement
Implementation
then
You just need to paste this in here. Okay, so now we are done in here
Um, I already have it but I have 11.0.4
I
Didn't use 11.4.2. I didn't want to use it. I don't know why but I just like the older version better
Now once I have these services or these services installed I can click on sync and I will have those services
I know the work is really tedious, but
The result is awesome. So a little bit of work with awesome result. It doesn't matter
Now let's go to google
And search for place picker
android
And we're going to go to the first
page on developers dot
google.com
And this is the this is our first snippet
So we need to create a builder
Intent builder and then start activity for result and builder dot build and the place picker request easy, right?
So we're going to say come here back and in here we're going to say
var
builder
Is equal to place picker
dot
Intent builder and this is all the first step is this the second step is
uh, we're going to say
Start activity for result start activity for result. The first thing is the intent
And then is the request code
So what is intent? Well the builder
dot
Build and this this is the intent that we are going to be using
and
the
Request code will be zero
Now once I have this I can go and check out what happened with my project I can come in here
Click on this
and now if I click on this I get that pop-up that I had last time I showed you the
Preview of the application. So this is the
Pop-up it was a little bit of work. But as you can see the result is awesome with just two lines of code
Now if because we are returning something
We'll come back in here and we'll go to control or and we're going to say on activity
result
and
so the first thing we are going to be doing is we're going to say if
the request code
is equal to zero
and
The result code is equal to result. Okay
Then then we are going to come back in here and go to places api. And as you can see we have
places
uh object
Says place picker dot get place so we can come in here and say var
Places
of type place
Is equal to place picker
dot get place
Now we require two things the context and the intent the context is this and the intent is the data
And as you can see we have this now, we are going to say places
dot
Get lat long means latitude longitude
dot
Latitude
So we can say in here var lat is equal to latitude
And similarly we can say var
Long is equal to
places
dot lat long dot
Longitude now, we're going to say txt1 dot set text and inside in here. We're going to say latitude
Now if I click on this and select the location
And click on select as you can see I get the latitude and I get the longitude
Okay, guys, that was all for this tutorial and bye. Bye
Yo, what's up guys assalamualaikum welcome to this tutorial and in this tutorial
We are going to be learning about the intent filter
So let's get started
First of all, what is an intent filter?
Now don't go on the name. The name is really uh creepy. I mean intent filter. What does it supposed to mean?
Well in simple words, it means what kind of
Intents will your application receive for example, we have uh, google maps, right?
so google maps
Receives the intents which start with
Geo, right if I have geo then I have the coordinate like 25.36
And 68 point or 36 point 25. So if I have latitude and longitude
and
That and long so so this type of scheme
the uh
Google maps accepts similarly
Let us suppose you are making a similar app that is called a ride sharing
So let's say ride sharing
Is an app that you are making and it basically can accept the uh
Geo values so it can accept the geo values
So what you are going to do is you're going to make sure that you add a filter an intent filter
Which will make sure that once uh, someone asks for a geolocation
Your application also comes into the list. For example, google maps
google maps
And then the uber
As we have seen in the previous videos and lastly, we will see our ride sharing app
Which will be able to open the geolocations
So if you want your app to do something or to accept the these kind of intents
Then that basically is done using intent filter
so to recap what we have just said basically intent filter is what kind of
Intents do you want to accept? For example, do you want to accept the browser intents?
or the geo intents
Or the youtube intents just giving you as an example
so if it's uh, if i'm trying to play a video it will open up youtube if i'm trying to uh,
display a map it will uh
Display a map so we have to give in here a geolocation
Similarly the browser basically we have to make sure we add an intent filter which will uh,
Say that accept the intent which are asking for the browser
Okay guys that was all and i'll see you in the next tutorial. Bye. Bye
Hey, what's up guys?
Now before we start let me tell you that an intent filter has three parts
The action the category and the last one is called data
So let us actually copy this from the main and let me go to my second activity
Which is this second activity and i'm gonna paste my intent filter in here
Now let us actually take these two
So as I told you the first thing is action so we can have action an action has a name
And that first one is view basically
Then we have this what is this action? Well, this action refers to this action in here
Right intent dot action view
So if you want to view something you would say action view and in the manifest it will know that oh
It is calling for action view basically this application might be the one
Okay, so it will consider your application
Because the action you are trying to do the same as action this this action number two
You have to go give all the information, uh category
Then if you say wait
What kind of apps will it be able to?
Uh support for example is it will it view the map apps?
Or will it view the browser apps?
Or will it view the email apps and so on so forth?
So we will say browsable means it will accept the browser apps
Now the last thing we need is data
So if I come in here
and say data
And in here we're going to say scheme. So we remember the data scheme is like for example geo
Or something like that. Remember last time we had this
Let me take this in here from here and let me put slash in here
Similarly if I say data and android scheme and in here instead of this i'm going to say http. Yes
In here instead of geo i'm going to say
Uh http. Oh, by the way, you can't have colon in here. That's why it is giving you an error
The last thing you want to do is you want to add
Last category that is category default. So i'm going to say
Category default
The category default basically is used to be considered by the start activity or start activity for results
So if you want to use this you have to have it. It's something like default have it
So that intent filter can know that this is an implicit intent
now what we are going to do is
Uh, we're going to go to our main activity and as you can see in here I have a uri
Action view this uri goes to geo instead of this i'm going to go to http
Google.com
So
If the value starts with http
Then it's going to use our activity
means second activity
If the value starts with https means uri starts with https still it will consider our
Activity that is the second activity. Now, let us play this and let's see how it performs
Now if you see in here, I have something called nearby drivers means this button here
So it never nearby drivers and if I click on this button in here
It will ask me uh for
I basically i'm asking you to go to
Uh this link in here http.google.com
So when it sees the this uri then it considers all the applications that are accepting
That are accepting such invitations
So http is being accepted by google by uc browser by the puffin browser and the phx browser
Similarly, it is being uh considered or being accepted by our activity second activity
So if I click on just
Once for this time as you can see it opens up our second activity
So intent filter basically refers to what kind of uh intent do you want to accept?
or in what kind of uh
Or in what kind of implicit intents do you want your uh, your activity to appear in the chooser
and whereas chooser refers to
This thing this thing in here is called chooser. Okay guys, that was all and bye. Bye