Android

Android Intents/Filters

Android Intents/Filters

An Android Intent is a brief description of the operations that are going to be performed. Intent can be used by implementing the startActivity method that launched the activity. The boradcastIntent is used to send the activity to BroadcastReceiver components that require the activity. After that, startService(Intent) allows the activity to start and bindService binds the activity for that component. 
See the code snippet below to better understand Intents in our AndroidManifest.xml file:

<activity android:name=".Activity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <data android:mimeType="text/plain"/>
    </intent-filter>
</activity>

As we can see in the code above there are few intents in our code. However, there can be multiple intents that can be used for different purposes. The MainActivity in our code is just like an entry point for the app that initiates the activity. 
 

Top course recommendations for you

    GitHub Profile
    1 hrs
    Beginner
    5.8K+ Learners
    4.23  (105)
    Arduino vs Raspberry Pi
    2 hrs
    Beginner
    5.5K+ Learners
    4.56  (291)
    DevOps Landscape
    2 hrs
    Beginner
    2.2K+ Learners
    4.51  (71)
    Joins in SQL
    2 hrs
    Beginner
    8K+ Learners
    4.47  (281)
    Design Thinking for Beginners
    1 hrs
    Beginner
    11.8K+ Learners
    4.41  (781)
    Database Management System
    1 hrs
    Beginner
    29.5K+ Learners
    4.44  (2048)
    Operational Excellence and Critical Thinking
    1 hrs
    Beginner
    5.6K+ Learners
    4.49  (264)
    Become a Web Developer
    1 hrs
    Beginner
    14.4K+ Learners
    4.4  (316)
    .NET Fundamentals
    2 hrs
    Beginner
    19.5K+ Learners
    4.46  (1006)
    .NET OOPS
    1 hrs
    Beginner
    5.2K+ Learners
    4.55  (223)