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.8K+ Learners
    4.64  (907)
    Joins in SQL
    2 hrs
    Beginner
    11K+ Learners
    4.4  (720)
    Design Thinking for Beginners
    1 hrs
    Beginner
    15.9K+ Learners
    4.38  (2045)
    Database Management System
    1 hrs
    Beginner
    43.6K+ Learners
    4.39  (6072)
    Become a Web Developer
    1 hrs
    Beginner
    18.3K+ Learners
    4.39  (358)
    .NET Fundamentals
    2 hrs
    Beginner
    24.8K+ Learners
    4.42  (2106)