1. Check out our companion app, Forums for Android! Download from Google Play

Difficulties with Intents

Discussion in 'Application Development' started by AndDevloper, May 21, 2010.

  1. AndDevloper

    AndDevloper New Member
    Thread Starter
    5

    Apr 20, 2010
    3
    0
    5
    Hey,
    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?
     

    Advertisement

  2. safibaba

    safibaba Member
    15

    May 3, 2010
    15
    0
    15
    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

Loading...