Was fine for early days but even after 10 years of development, we 
shouldn't have to stick to an early bad design choice. 
Forcing to have duplicates is a recipe for future errors. 

res/raw_string or some such could always be used instead of 
res/values/string.



On Tuesday, September 14, 2010 at 5:24:09 AM UTC+5:30, Dan wrote:
>
> 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 <[email protected]> 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 <[email protected]> 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 [email protected] 
> <javascript:> 
> > > To unsubscribe from this group, send email to 
> > > [email protected] 
> > > <javascript:><android-developers%2Bunsubs 
> [email protected] <javascript:>> 
> > > For more options, visit this group at 
> > >http://groups.google.com/group/android-developers?hl=en 
> > 
> > -- 
> > Dianne Hackborn 
> > Android framework engineer 
> > [email protected] 
> > 
> > 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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/3f5f5255-bb37-4a0e-a5db-c92e4b4260b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to