 Hello everyone. So, in this video, we are going to see intents in Android. I am Professor Dattadri Gandhwal from Walchand Institute of Technology, Sulapur, from Computer Science and Engineering Department. So, what students will be able to do after watching this video? Students will be able to identify types of intent, write code to create intents in Android, so they will be able to do a coding on creating an intent. The introduction to intent in Android. What is intent? Intent is a simple message object that is used to communicate between Android components such as activities, content provider, broadcast receivers and services. You might be aware with this activities, content provider, broadcast receivers and services, right? Intent is nothing but a part which is used for communication purpose. That's it. So, if you want, if I want to communicate from one activity to another activity or from content provider to broadcaster or any kind of component, communication is possible only with help of intent. Intents are also used to transfer data between activities. Suppose I want to pass a message from one activity to another activity, then intent can be used to pass communication purpose or transferring data. Intent can be used. If I want to pass a message, let's say, hello, how are you? This kind of message transfer can take place from within your mobile that is possible with help of intent. How generally starting an intent? How you would start an intent? That can be started using start activity method. There is a method called a start activity. Using the start activity, you can start an intent. I hope this is clear. Use of intent. What are the uses of intent? For launching an activity, to start a new service, a service like a message service you want to do for broadcasting messages or any kind of third party services, we can use an intent to display a list of contacts in ListView. So, this is one type of intent that is nothing but. So, when you click on a button and try to browse your contact list, that means you are asking or moving from one page to another page. This moving from or communicating from one page to another place will happen using intent. This diagram tells that when I click on click me, this is what a second activity will be loaded. This loading of second activity on a button click is happening with help of intent. So, intent will have some kind of structure based on that. This loading will happen. We will see to it. Don't worry. But there are types of intent. There are two types, major two types of intent. One is implicit intent and another is explicit intent. Okay, what is the meaning of implicit intent? Implicit intent is an intent where instead of defining the exact component, you define the action that you want. Okay, there are many inbuilt functions that you want to call. Like for example, I want to make a call. I want to download something. I want to browse my contact list. These are all types of implicit. There is certain a phone call comes. You are moving, you are switching from one activity to another activity. This things will happen with help of intent. This is a part of implicit intent. This is how we define intent. Intent i equal to new intent. So here, what is happening? Intent is a class. And i is a object. So object i is created for intent class. Then once you create this object, I can use all the methods present inside that particular class intent. So i equal to set action. What action I am going to do, intent dot action send. So if I want to send a particular message, so send action will do this. So these are all inbuilt functions which are there that I can use using this intent dot actions. And there are a variety of things we will see to it. So this is how generally we will do. First of all, I need to create object of intent. Then I will call method called a set action. Oh, this is clear. Explicit intent. So here explicitly I need to create an intent. Explicit intent is an intent where you explicitly define the component that needs to be called. So here, let's say it is nothing but I can give an example of creating multiple pages. One page is calling on another page. An activity one is calling second activity. This is an example of explicit intent. So here, with the help of code, you can understand it. Intent i equal to new intent. So first, there are two parameters for it. First is get application context. And second is next activity dot class. So here, get application context. What is this? It works as a this pointer. It will point to the current application. And next activity dot class, the activity which you want to load, you need to pass it as a second parameter. Okay. And further, as we have seen, it is also used to transfer some kind of data, right? So how can we achieve it using I dot put extra? I dot put extra, what it is going to do? It is going to pass two parameters again. In first parameter, it is going to be a key value pair. Here it is passing some value one, this value for next activity. So your value one will work as a key. And this value for next activity will pass a message to it that will be the value associated with particular key. Similarly, I can have many keys and many values. I dot put extra will send some value that is a key over here. It can be a string, it can be an integer, it can be of any data type. And this value for next activity will work as a value for it. So basically, don't confuse over here. It is just simple. It's a key and it's a value. You're just passing key value. So at the receiver end, it will receive the keys and the fetch respective values from it. So if I want to call a second activity on button click, when I click on it, a second activity will be loaded. This is how explicit intent will take place. Okay. Now, the small question for you, how to create object of an implicit intent, you can pause over here and give answer for it. You have just now seen it. Okay. If you are able to do this, that means you are falling rightly. Answer for it. Intent i equal to new intent. Just now we have seen yes, here you can see that. Yes, intent i equal to new intent. This is how we create intents implicit intent special. Okay. Next, what are the different methods used in intent? These are the variety of methods used in intent as we have seen. Action send we have just now seen it right. During implicit intent, right? Likewise, we have many such methods. Action main action pick action chooser action dial action call action send and action send to we will see all these methods one by one. These are very important methods to understand understand intent. Now action main. What is happening in action main? Action main here, we are going to give the name of the action. So your Android name equal to string, we are putting action over here, that means something has to happen. Okay. So what will happen action main string, so action will be loaded. Okay. So likewise, I can so when I write this particular XML file into we have to write it in XML file, make a note of it. Okay. When you do this, what will happen? Complete action string. So this particular string will be loaded. Okay. So pages are changing. Intents are nothing but you are changing the page pages, you are sending some messages. Next action pick. So it's a picker intent. So again, you need an intent for it to do some kind of picker messages, new intent action pick when I pass this action pick over here, what I need to do here, photo picker intent. So it is taking some kind of photo picker, and I am trying to load a set type image. So this we can do it start activity for results. So photo picker intent select photo. So this particular picker intent will be loaded onto the page. You can see with this L pop image, you it will be clear. Okay. So yeah, this is a photo picker. So take a photo either a choose from library. Oh, this is coming. This will come with help of this particular intent. Okay. Makes sense. Yeah. Next action chooser intent select equal to new intent action camera. Here I'm choosing a camera if I want to choose a camera, I can use action camera. So your camera will be loaded. So now again, you choose an action from it either you can take it from gallery either from camera either from photo. So when you're moving from one intent to another intent, this one activity to another activity, this is possible with the help of intent. That is through intent messages. Action dial when you do a dialing on your mobile phone, this example, I think will help you a lot. Action dial when you put a dial a dialer phone will come. Yes, this is a dialer keyboard. This will come this is one type of activity and with help of intent, we can do this call when you make a call to someone. Yes, as I said, these are all different types of activities which can be achieved through intent. So when I make a call, so suddenly I make a call on press on call button, so I'll be moving to calling action send. If I want to make some text messages to some particular number, I can send it through action send. So extras I'll be need. This is my text to send. So this is the text message, your type of text and that will be sent as a parameter. This is what happened when you click on messaging messaging app. Action send to send to a particular number. So here I'm dialing a number and I want a message should be delivered to that particular number. This can be done with put extra method. Here you can see put extra method. Okay, this is a number which I have dialed one some 55521555. Yes, it can be any other number. It's a generally I've taken. So these are some of the references very good references, you can refer them for more information. Okay, I hope you have understood this topic. Thank you.