Don't do that.  The string must be in the manifest.  (It would make things
much more complicated if these strings could change due to locale changes,
screen orientation changes, etc.)

On Mon, Sep 13, 2010 at 4:06 PM, Dan <king...@gmail.com> wrote:

> I have a Service defined in the manifest with an intent filter that
> refuses to match when specified as a String resource but works when
> the literal action is entered in the manifest.  Is there any reason I
> should not be able to use a String resource with an action in an
> intent filter?
>
> For example:
>
> Manifest Snippet
>
> <service android:name=".subpackage.MyService">
>        <intent-filter>
>                <action
> android:name="com.company.application.subpackage.RUN"></
> action>
>                <!-- This does not work at all, but I expect it to
>                <action android:name="@string/actionMyServiceRun"></action>
>                -->
>        </intent-filter>
> </service>
>
> Resource Snippet:
>        <string
> name="actionMyServiceRun">com.company.application.subpackage.RUN</
> string>
>
> Code Snippet:
> Intent i = new Intent();
> // Either of the below lines work
> i.setAction(getString(R.string.actionMyServiceRun));
> // i.setAction("com.company.application.subpackage.RUN");
> i.putExtra(SitewerxService.EXTRA_RUN_CONTINUOUS, b);
>
> startService(i);
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to