Speaking of CharSequence: the TextUtils helper class has a lot of
useful methods of working with CharSequence objects.  You can
basically do anything that you with String objects, such as equals(),
contact(), indexOf(), etc.  indexOf() is a replacement with
startsWith().   Which is why I said you can use CharSequence 99% of
the time in Android.

The only common methods I haven't found a replacement for are
toLower() and toUpper().

On May 17, 10:23 am, Zsolt Vasvari <[email protected]> wrote:
> Just one comment -- not really specific to Android, but Java in
> general:
>
> You should be using the "most" base class that you can get away with,
> so in the case of Android, 99% of the time you can use CharSequence
> instead of String, so your code would be:
>
> CharSequence[] textValues =
> getResources().getTextArray(R.array.your_string_array);
> for (int i = 0; i < textValues.length; ++i) {
>     mTextView.setText(textValues[i]);
>
> On May 17, 9:23 am, Spooky <[email protected]> wrote:
>
>
>
> > On May 16, 7:15 pm, Nicholas Johnson <[email protected]> wrote:
>
> > > Something like this should work:
>
> > > String[] textValues =
> > > getResources().getStringArray(R.array.your_string_array);
>
> > > for (int i = 0; i < textValues.length; ++i) {
> > >    mTextView.setText(textValues[i]);
>
> > > }
>
> > > ^obviously this code isn't very useful, but you get the idea.
>
> > Quite the opposite:  it is extremely useful---you just showed me how
> > to do exactly what I needed to do to show a title next to each photo
> > in my photography apps.  I can easily adapt this from this point.  :-)
>
> > Many thanks!
> >    --jim
>
> > --
> > 73 DE N5IAL/4
> > Web site:  http://www.jstrack.org
> > Do not look into laser with remaining eye.- Hide quoted text -
>
> - Show quoted text -

-- 
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]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to