And if you just want spaces in specific places in the string, just put it in quotes or use \ to prevent it from being stripped.
On Wed, Mar 4, 2009 at 3:29 PM, Marco Nelissen <marc...@android.com> wrote: > > If you want to make sentences, it's still a good idea to put a format > string in the resource and then use that, since you'll be able to > correctly localize your app later on. > To use this with a Cursor and ListView, create a custom Adapter (you > can probably just derive from SimpleCursorAdapter), and override the > bindView() method. Then inside that method you can do whatever you > want to set the text for the views in your list items, including > gathering data from several columns in the database and combining them > in to one string. > > > > On Wed, Mar 4, 2009 at 3:07 PM, droozen <droozenr...@gmail.com> wrote: > > > > Okay, I see, but I guess I didn't explain my entire issue. I don't > > know a whole lot about working with the SQLite databases, so right now > > I'm able to do what was done in the Notepad tutorial, get values from > > the database and tie them to ids of TextViews to display them. But > > part of the list I wanted to put together some of the values into a > > sentence. So I split it up into several text views. I have "Some > > string blah blah ", then the next TextView holds the value returned. > > Is there a way I can manipulate the data in each row to put it in my > > list? I just follow the Notepad tutorial right now. :S > > > > On Mar 3, 12:30 pm, Marco Nelissen <marc...@android.com> wrote: > >> On Tue, Mar 3, 2009 at 6:26 AM, droozen <droozenr...@gmail.com> wrote: > >> > >> > So, we're supposed to be using our strings.xml to construct most or > >> > all of our strings, right? I had a situation where I wanted to display > >> > to the user "Somestringblah blah " + some value. So I put two views > >> > in a horizontal LinearLayout, with my "Somestringblah blah " (with > >> > thatspaceon the end, no quotes) in the strings.xml. I reference the > >> >stringin my first view, then set the value in the second view. > >> > However, if I set it up like this, thespaceat the end of mystring > >> > gets trimmed off, which doesn't look pretty. My workaround was not to > >> > use the strings.xml and place the "Somestringblah blah " (no quotes) > >> > directly in the android:text parameter of the TextView. > >> > >> > Any idea if there is a better way to do this? Or should I submit a bug > >> > to Android about this? > >> > >> Instead of breaking up thestringand using two TextViews to display > >> what is supposed to be a singlestring, you should use a single > >> TextView and astringin your resource like "Somestringblah blah > >> %s", and then use the version of Context.getString() that takes > >> format-arguments. > > > > > > > > > -- 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. 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 -~----------~----~----~----~------~----~------~--~---