Spaces in strings.xml strings

by droozen » Wed, 04 Mar 2009 02:01:21 GMT


Sponsored Links
 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 "Some string blah blah " + some value. So I put two views
in a horizontal LinearLayout, with my "Some string blah blah " (with
that space on the end, no quotes) in the strings.xml. I reference the
string in my first view, then set the value in the second view.
However, if I set it up like this, the space at the end of my string
gets trimmed off, which doesn't look pretty. My workaround was not to
use the strings.xml and place the "Some string blah 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?

--~--~---------~--~----~------------~-------~--~----~



Spaces in strings.xml strings

by Marco Nelissen » Wed, 04 Mar 2009 02:30:48 GMT


 


Instead of breaking up the string and using two TextViews to display
what is supposed to be a single string, you should use a single
TextView and a string in your resource like "Some string blah blah
%s", and then use the version of Context.getString() that takes
format-arguments.

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Spaces in strings.xml strings

by droozen » Thu, 05 Mar 2009 07:07:18 GMT


 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





--~--~---------~--~----~------------~-------~--~----~



Spaces in strings.xml strings

by Marco Nelissen » Thu, 05 Mar 2009 07:29:15 GMT


 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.









--~--~---------~--~----~------------~-------~--~----~



Spaces in strings.xml strings

by Dianne Hackborn » Thu, 05 Mar 2009 10:25:47 GMT


 nd 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:



--
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.

--~--~---------~--~----~------------~-------~--~----~



Spaces in strings.xml strings

by droozen » Thu, 05 Mar 2009 22:56:27 GMT


 Thanks. I'll try it out!







--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Android 2.0 has Multitouch Keyboard yes or no?

Everything I read points to know, but Google's Android SDK page
clearly says that it does:
http://developer.android.com/sdk/android-2.0-highlights.html

Quoting:
"Android virtual keyboard
An improved keyboard layout to makes it easier to hit the correct
characters and improve typing speed.
The framework's multi-touch support ensures that key presses aren't
missed while typing rapidly with two fingers."

Anyone know why they put this in the SDK notes when it does not have
this functionality?

--

2. Binder problem on omap3530 beagle

I have a binder problem when I am porting Android on my OMAP3530 beagleboard
which I have modified some hardware structure.

The linux kernel is downloaded from Mistral OMAP3EVM, and the configuration
file is loaded from omap3_android_beagle_defconfig.

The Root File System is also downloaded from Mistral.

I think this is the critical keypoint which produces the problem, but I
don't know how should I start to debug.



There are so much binder message in the system log, such as:

binder: release 734:738 transaction 403 in, still active
binder: send failed reply for transaction 403 to 780:780
binder: 689:700 transaction failed 29189, size 168-0
binder: release 801:852 transaction 987 in, still active
binder: send failed reply for transaction 987 to 845:845
binder: 689:703 transaction failed 29189, size 168-0
binder: release 884:934 transaction 1539 in, still active
binder: send failed reply for transaction 1539 to 929:929

and it would not stop.


I don't know where is the bug which I should handle, could anyone give me
some suggestion, please?


## Booting kernel from Legacy Image at 80000000 ...
   Image Name:   Linux-2.6.28-OMAP3EVM-1.1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1940492 Bytes =  1.9 MB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing
Linux...............................................................................................................................
done, booting the kernel.
Linux version 2.6.28-OMAP3EVM-1.1 (r...@michael-ubuntu) (gcc version 4.2.3
(Sourcery G++ Lite 2008q1-126)) #2 Wed Dec 23 18:05:18 CST 2009
CPU: ARMv7 Processor [411fc083] revision 3 (ARMv7), cr=10c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OMAP3 Beagle Board
Memory policy: ECC disabled, Data cache writeback
OMAP3430 Unknown revision

SRAM: Mapped pa 0x40200000 to va 0xd7000000 size: 0x100000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: mem=128M androidboot.console=ttyS2
console=ttyS2,115200n8 root=/dev/mmcblk0p2 rw rootdelay=2
Unknown boot option `androidboot.console=ttyS2': ignoring
Clocking rate (Crystal/DPLL/ARM core): 26.0/332/500 MHz
GPMC revision 5.0
IRQ: Found an INTC at 0xd8200000 (revision 4.0) with 96 interrupts
Total of 96 interrupts on 1 active controller
OMAP34xx GPIO hardware version 2.5
PID hash table entries: 512 (order: 9, 2048 bytes)
OMAP clockevent source: GPTIMER12 at 32768 Hz
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125296KB available (3616K code, 703K data, 132K init)
Calibrating delay loop... 482.11 BogoMIPS (lpj=1884160)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 288 bytes
regulator: core version 0.5
NET: Registered protocol family 16
Found NAND on CS0
Registering NAND on CS0
OMAP DMA hardware revision 4.0
USB: No board-specific platform config found
i2c_omap i2c_omap.1: bus 1 rev3.12 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
i2c_omap i2c_omap.3: bus 3 rev3.12 at 400 kHz
SCSI subsystem initialized
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=0
musb_core_init 1405: reconfigure software for static FIFOs
musb_hdrc musb_hdrc: musb_init_controller failed with status -19
regulator: VMMC1: 1850 <--> 3150 mV normal standby
regulator: VDAC: 1800 mV normal standby
regulator: VUSB1V5: 1500 mV normal standby
regulator: VUSB1V8: 1800 mV normal standby
regulator: VUSB3V1: 3100 mV normal standby
regulator: VSIM: 1800 <--> 3000 mV normal standby
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
ashmem: initialized
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
JFFS2 version 2.2. (NAND) ? 2001-2006 Red Hat, Inc.
msgmni has been set to 245
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver4 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0x4806a000 (irq = 72) is a ST16654
serial8250.0: ttyS1 at MMIO 0x4806c000 (irq = 73) is a ST16654
serial8250.0: ttyS2 at MMIO 0x49020000 (irq = 74) is a ST16654
console [ttyS2] enabled
brd: module loaded
loop: module loaded
i2c /dev entries driver
Driver 'sd' needs updating - please use bus_type methods
omap2-nand driver initializing
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 256MiB 1,8V
16-bit)
cmdlinepart partition parsing not available
Creating 5 MTD partitions on "omap2-nand":
0x00000000-0x00080000 : "X-Loader"
0x00080000-0x00260000 : "U-Boot"
0x00260000-0x00280000 : "U-Boot Env"
0x00280000-0x00680000 : "Kernel"
0x00680000-0x10000000 : "File System"
usbmon: debugfs is not available
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-omap ehci-omap.0: OMAP-EHCI Host Controller
ehci-omap ehci-omap.0: new USB bus registered, assigned bus number 1
ehci-omap ehci-omap.0: irq 77, io mem 0x48064800
ehci-omap ehci-omap.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: OMAP-EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.28-OMAP3EVM-1.1 ehci_hcd
usb usb1: SerialNumber: ehci-omap.0
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
twl4030_rtc twl4030_rtc: rtc core: registered twl4030_rtc as rtc0
mmci-omap-hs mmci-omap-hs.0: Failed to get debounce clock
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
logger: created 64K log 'log_main'
logger: created 256K log 'log_events'
logger: created 64K log 'log_radio'
Advanced Linux Sound Architecture Driver Version 1.0.18rc3.
ASoC version 0.13.2
OMAP3 Beagle SoC init
TWL4030 Audio Codec init
asoc: twl4030 <-> omap-mcbsp-dai-(link_id) mapping ok
ALSA device list:
  #0: omap3beagle (twl4030)
TCP cubic registered
NET: Registered protocol family 17
NET: Registered protocol family 15
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
Power Management for TI OMAP3.
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
twl4030_rtc twl4030_rtc: setting system clock to 2000-01-01 02:03:12 UTC
(946692192)
Waiting 2sec before mounting root device...
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 USD   3.74 GiB
 mmcblk0: p1 p2
kjournald starting.  Commit interval 5 seconds
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on mmcblk0p2, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem).
Freeing init memory: 132K
init started: BusyBox v1.8.1 (2007-11-14 09:47:41 EST)
starting pid 389, tty '': '/startme'
 Disabling Power mgmt       : /startme: cannot create
/sys/power/cpuidle_deepest_state: directory nonexistent
 Turn off LCD after 1 hour  : /startme: cannot create
/sys/power/fb_timeout_value: directory nonexistent
Socket created.
Bind completed!

[Thread]: cmd_processor_name=COMMON_TASKS_SLOW

[deQueueCmdPkt]: COMMON_TASKS_SLOW waiting ...

[Thread]: cmd_processor_name=COMMON_TASKS_FAST

[deQueueCmdPkt]: COMMON_TASKS_FAST waiting ...

[Thread]: cmd_processor_name=AUDIO_CTRL_TASKS

[setMasterVolume]: cmd_buf=/usr/bin/amixer cset numid=2 70

[Thread]: cmd_processor_name=AUDIO_PB_REC_TASKS

[deQueueCmdPkt]: AUDIO_PB_REC_TASKS waiting ...
sh: /usr/bin/amixer: not found

[deQueueCmdPkt]: AUDIO_CTRL_TASKS waiting ...
rm: cannot remove '/dev/alarm': No such file or directory
BusyBox v1.8.1 (2007-11-14 09:47:41 EST) multi-call binary

Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR

Create a special file (block, character, or pipe)

Options:
        -m      Create the special file using the specified mode (default
a=rw)

TYPEs include:
        b:      Make a block (buffered) device
        c or u: Make a character (un-buffered) device
        p:      Make a named pipe. MAJOR and MINOR are ignored for named
pipes

chmod: /dev/alarm: No such file or directory
Initializing Android...
This process may take atlease 2-3 minutes
to bring up the home page, please wait.......
init: cannot open '/initlogo.rle'
# warning: `app_process' uses 32-bit capabilities (legacy support in use)
binder: release 734:738 transaction 403 in, still active
binder: send failed reply for transaction 403 to 780:780
binder: 689:700 transaction failed 29189, size 168-0
binder: release 801:852 transaction 987 in, still active
binder: send failed reply for transaction 987 to 845:845
binder: 689:703 transaction failed 29189, size 168-0
binder: release 884:934 transaction 1539 in, still active
binder: send failed reply for transaction 1539 to 929:929
action 'up' failed (No such device)
action 'dhcp' failed (No such device)
binder: 689:701 transaction failed 29189, size 168-0
binder: release 967:971 transaction 2030 in, still active
binder: send failed reply for transaction 2030 to 1019:1019
binder: 689:706 transaction failed 29189, size 168-0
binder: release 1043:1093 transaction 2540 in, still active
binder: send failed reply for transaction 2540 to 1088:1088
binder: 689:689 transaction failed 29189, size 168-0
binder: release 1111:1161 transaction 3102 in, still active
binder: send failed reply for transaction 3102 to 1156:1156
binder: 689:707 transaction failed 29189, size 168-0
binder: release 1196:1200 transaction 3601 in, still active
binder: send failed reply for transaction 3601 to 1241:1241
binder: 689:700 transaction failed 29189, size 168-0
binder: release 1263:1267 transaction 4178 in, still active
binder: send failed reply for transaction 4178 to 1308:1308
binder: send failed reply for transaction 4262 to 1328:1328
binder: 689:703 transaction failed 29189, size 168-0
DHCP configured
binder: release 1347:1352 transaction 4633 in, still active
binder: send failed reply for transaction 4633 to 1392:1392
binder: 689:701 transaction failed 29189, size 168-0


Please give me some suggestion to start, I would appreciate very much!!

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. how to recover offline devices.

4. Porting problem on SMDKC100~~system kernel panic

5. New Developer and Application and Nexus One Lover

6. make Android to support multi displays architecture

7. Join us on GoogleWave