风度翩翩的柿子 · Scope functions | ...· 1 周前 · |
想出国的皮蛋 · Starset - Monster ...· 2 周前 · |
宽容的铁链 · 招聘后端开发的面试题及考核要点 - MBA智库问答· 3 月前 · |
聪明伶俐的甘蔗 · 李奇 - 西南交通大学 - 电气工程学院· 6 月前 · |
不开心的开心果 · IoTDB Website· 6 月前 · |
淡定的打火机 · BaseFont (iText ...· 6 月前 · |
In Android, it is quite usual for users to witness a jump from one application to another as a part of the whole process, for example, searching for a location on the browser and witnessing a direct jump into Google Maps or receiving payment links in Messages Application (SMS) and on clicking jumping to PayPal or GPay (Google Pay). This process of taking users from one application to another is achieved by passing the Intent to the system. Intents , in general, are used for navigating among various activities within the same application, but note, is not limited to one single application, i.e., they can be utilized from moving from one application to another as well.
Intents could be Implicit, for instance, calling intended actions, and explicit as well, such as opening another activity after some operations like onClick or anything else. Below are some applications of Intents:
The collaborative nature of Android applications only results in a better user experience. The question here is if the intent is for an application that is not present in the device, what’s the next call?
Deep Link is an URL that redirects the device to the API of that Missing Application and then the service is run on the system to check if a version of that application exists on the device. For time being, let’s assume that the application is not available on the device and no previous versions ever existed. This service then makes a call to the Play Store from the device and the application appears, just a matter of download.
Not deviating from the topic, there are a few examples that already exist in Android Studio for redirecting to other applications, for example, Dialing Numbers, Sending SMSs, Opening Settings, etc. Everyday examples include redirecting to YouTube, Maps, WhatsApp, Facebook, etc. Android community, especially the Kotlin Community is at its zenith every single impending day. Kotlin has witnessed a huge amount of sudden growth in the past few years and could be one of the vital tools in the future replacing Java & possibly Julia also.
Implicit Intent doesn’t specify the component. In such a case, intent provides information on available components provided by the system that is to be invoked. For example, you may write the following code to view the webpage.
Syntax:
Intent intent=new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("https://www.geeksforgeeks.org/")); startActivity(intent);
For Example: In the below images, no component is specified, instead, an action is performed i.e. a webpage is going to be opened. As you type the name of your desired webpage and click on the ‘CLICK’ button. Your webpage is opened.
Explicit Intent specifies the component. In such a case, intent provides the external class to be invoked.
Syntax:
Intent i = new Intent(getApplicationContext(), ActivityTwo.class); startActivity(i);
For Example: In the below example, there are two activities (FirstActivity, and SecondActivity). When you click on the ‘GO TO OTHER ACTIVITY’ Button in the FirstActivity, then you move to the SecondActivity. When you click on the ‘GO TO HOME ACTIVITY’ button in the SecondActivity, then you move to the first activity. This is getting done through Explicit Intent.
Note : To know more about the types of intent with example code please refer to Implicit and Explicit Intents with Examples .
Like Article宽容的铁链 · 招聘后端开发的面试题及考核要点 - MBA智库问答 3 月前 |
聪明伶俐的甘蔗 · 李奇 - 西南交通大学 - 电气工程学院 6 月前 |
不开心的开心果 · IoTDB Website 6 月前 |