Is there any way to put extras to Intent from preferences?

Alex Volovoy picture Alex Volovoy · Jan 17, 2010 · Viewed 36.7k times · Source

Hi i'm launching activity from preferences screen. Activity is shared among three preferences. I wonder if i can set extras for this activity in xml

<Preference
    android:key="action_1"
    android:title="@string/action_1_title"
>
    <intent
        android:action="com.package.SHAREDACTION"
    >

    </intent>
</Preference>

i wonder if i can do something like

<extras>
     <item
      android:name=""
      android:value=""/>
</extras>

All i need to do to pass an integer really. I can different actions and check action instead of extras.

Answer

ludwigm picture ludwigm · Mar 5, 2010

I got an answer, you can use it like this:

<Preference
    android:key="xxx"
    android:title="xxx"
    android:summary="xxx">
   <intent android:action="xxx" >
         <extra android:name="xxx" android:value="xxx" />
    </intent>        

</Preference>