That is true about the locale and orientation changes but at the same
time it is confusing.  This forces me to have the same String literal
in multiple places, thereby creating duplicate code and the manifest
editor presents one with a String resource selector, implying that a
String resource is an acceptable input.

I don't find String resources so confusing that I cannot separate
locale dependent Strings from each other. This is a good example of a
locale independent String such as SharedPreferences keys and Arrays of
numbers for an options list.

On Sep 13, 4:44 pm, Dianne Hackborn <hack...@android.com> wrote:
> 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%2Bunsubs 
> > cr...@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