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.3K+ Learners
    4.55  (616)
    Joins in SQL
    2 hrs
    Beginner
    10.6K+ Learners
    4.42  (603)
    Design Thinking for Beginners
    1 hrs
    Beginner
    14.8K+ Learners
    4.4  (1513)
    Database Management System
    1 hrs
    Beginner
    41.4K+ Learners
    4.39  (5258)
    Become a Web Developer
    1 hrs
    Beginner
    17.8K+ Learners
    4.4  (352)
    .NET Fundamentals
    2 hrs
    Beginner
    24.1K+ Learners
    4.41  (1907)