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.56  (642)
    Joins in SQL
    2 hrs
    Beginner
    10.6K+ Learners
    4.42  (616)
    Design Thinking for Beginners
    1 hrs
    Beginner
    15.1K+ Learners
    4.38  (1648)
    Database Management System
    1 hrs
    Beginner
    41.6K+ Learners
    4.39  (5324)
    Become a Web Developer
    1 hrs
    Beginner
    17.9K+ Learners
    4.4  (354)
    .NET Fundamentals
    2 hrs
    Beginner
    24.2K+ Learners
    4.41  (1922)