![]() |
In android, An Intent provides a facility for performing late runtime binding between the code in different applications. Its most significant use is in the launching of activities, where it can be thought of as the glue between activities. It is basically a passive data structure holding an abstract description of an action to be performed. What we are going to build in this article?In this article, we will learn that how we can pass Video using Intent between two activities and then play that video in the second activity. Here is a sample video of what we are going to build in this application. Note that we are going to implement this application using Java language. Step by Step ImplementationStep 1: Create a New Project
If you don’t know how to create a new project in Android Studio then you can refer to How to Create/Start a New Project in Android Studio? Step 2: Adding storage permission Follow the path app > manifests > AndroidManifest.xml and paste the following piece of code in it. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> Step 3: Working on XML files Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. XML
Follow the path app > right click > new > activity > Empty Activity > name it as “MainActvity2”. Navigate to the app > res > layout > activity_main2.xml and add the below code to that file. Below is the code for the activity_main2.xml file. XML
Step 4: Working on java files Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail. Java
Go to the MainActivity2.java file and refer to the following code. Below is the code for the MainActivity2.java file. Comments are added inside the code to understand the code in more detail. Java
Here is the final output of our application. Output: |
Reffered: https://www.geeksforgeeks.org
Android |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 8 |