1. HUGE Androidforums.com UPDATE! Learn what's new (and download the new app!)
    Dismiss Notice

Difficulties with Intents

Last Updated:

  1. AndDevloper

    AndDevloper New Member This Topic's Starter

    Apr 20, 2010
    Likes Received:
    I am facing some difficulties with intents. I will post all of my question here
    1. When I pass an intent from one activity from one activity to another, is it necessary for the activities to have an intent filter. I mean can there be no intent filter at all?

    2. Can I send string data though an Uri? If yes, how can I extract it at the other activity?

  2. safibaba

    safibaba Member

    May 3, 2010
    Likes Received:
    Hi AndDevelopr

    1. If the two activities are in the same application, there is no need to have an intent filter in the activity being launched if you are using startActivity()

    But if you are broadcasting an intent, then whatever activity needs to be 'listening' for the intent would need an intent filter - so that the Android OS knows which activity to wake up and give the message to.

    It's a bit like the difference between calling a function direct, and broadcasting an event. If you are broadcasting an event, something else needs to have registered itself as a listener to pick up the message. But if you are calling a function direct, you are triggering it directly.

    2. You can add extras data to the intent using the putExtras() method
    Intent | Android Developers

Share This Page