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

    Arduino vs Raspberry Pi
    2 hrs
    Beginner
    7.2K+ Learners
    4.54  (569)
    Joins in SQL
    2 hrs
    Beginner
    10.4K+ Learners
    4.45  (558)
    Design Thinking for Beginners
    1 hrs
    Beginner
    14.5K+ Learners
    4.38  (1375)
    Database Management System
    1 hrs
    Beginner
    40.8K+ Learners
    4.38  (4918)
    Become a Web Developer
    1 hrs
    Beginner
    17.7K+ Learners
    4.4  (349)
    .NET Fundamentals
    2 hrs
    Beginner
    23.9K+ Learners
    4.41  (1857)