Intent

Dhoyazan Adbo Othman
A free video tutorial from Dhoyazan Adbo Othman
Senior Trainer and Developer at Pioneers Academy
4.2 instructor rating • 9 courses • 29,619 students

Learn more from the full course

Android Cars App using Kotlin, PHP and Google Maps

Kotlin, Volley, PHP, SMS and Google Map API with features like Uber taxi app

08:07:23 of on-demand video • Updated May 2018

  • Understand Kotlin Programming Language from Scratch
  • Implement OOP concepts in Kotlin
  • Create PHP web service connected to MySQL database
  • Create android app using Kotlin
  • Use Volley and Picasso libraries to get data from PHP web services
  • Use Google Map API
  • Send SMS
  • Add Run-time permissions
  • Create car service project for customer and employee
English [Auto] Hello everyone in this video I'm going to talk about how can we implement the concept of navigation in Android starting an Android application if you need to go from one activity to another activity something like hyperlinks in Web sites. This is called intent. So we have a class called intent which allows you to go from one activity to another or either from one application to our other application. So at first let's create another activity. I already have in your project with activity called main activity. So how can we add another activity in this case just go here in the up folder and then inside the Jevon folder inside the first folder. Of Java just right click select new activity and then empty activity which means create a new activity. Let's suppose that we are going to call this activity as second AZT second activity and click on finish. Now we have two activity. The first one which is the main activity and another one which is the second activity. Now lets suppose that we need to go from the first activity to the second activity. In this case I'm going to the activity man and here the activity man I'm going to draw a button. And let's give ID for this button. Something like implicit which means go from one activity to another activity inside the same application or inside the same project. Let's call this one of Ben activity and let's add another button OK. And no I'm going to give I.D. for this button let's call it xP. Underscore button. I don't remember what I call it. This one in reset button. OK. Now here also explicit button and here are in the text. Let's write something like. Ben googled. So in this example I need if the user click on Open activity the second activity which is empty activity will be opened but if the user click on Open google the browser will be shown with the Google website. So how can we implement this example. Now let's go to the main activity and here I'm going to write something like ENP bottom don't set on a click on which means if the user click on the implicit button in this case I'm going to create an object from the intent class. This class is used to navigate from one activity to another activity or from one application to another application. So in the first one to navigate from this which means from the current activity which is main activity to Second City the second city is the name of the second activity then add double call on and select class and then write this function which is start activity. So very simple as you can see is only two lines which allow you to navigate from one activity which is the current activity to the second activity and then use the function start activity to implement this one. Now what about the explicit button which allow you to navigate from your application to another application which is the browser and open the Google web site. Inside this case I'm going to try something like explicit underscore button does sit on a click. Also here you need of course object of the class intent. But here in this example you don't need to pass the name of the activity but instead you write something like you are dude parts and the name. In this case the name of the Web site you are going to. For example it should T-P WIFW dot Google dot com OK. This is the first one. The second one here I am going to add also something called intent dot action underscore view. So we have to but I mean you are in this code or this object. The first one or sorry the second one using the you or I that parse to pass the website name which is Google. In this example of course you can use Google Yahoo or whatever. Then the action the action means what is the activity will pick up an inside the other application. For example in the browser you have two action which is the actual view to display the Web site and action search. If you need to open the browser with the purpose of search of course from where we can get all those action from the Web site developers dot Android dot com if we go to the developers that Android that can search for action you can go to all the actions for all the applications. Now just ads start activity. All right. Now let's try this example run and click on OK and let's see the result inside our immediate. So no if you click on Open activity yes. As you can see here the second activity has been up. What about if I click on of being Google it go to the browser and yes as you can see here it starts to open the Google web site. So in this video we have talked about how can we use the Internet class to implement the concept of navigation either from one activity to another activity inside the same application or from one application to another application. OK the next video we are going to use the same class for sending and receiving vans. So see the next video.