BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-10-2009, 06:11 PM   #1
egirotto
Knows Where the Search Button Is
 
Join Date: Mar 2009
Location: Bilbao
Model: 8900
PIN: N/A
Carrier: Vodafone
Posts: 29
Question xml configuration file

Please Login to Remove!

hi,
i need to use xml to config an application on start.
I read how to parse an xml and i know how write en xml file.
The problem is: where i save the xml files? I can't use the sd card and i don't know how save file in filesystem of simulator.
Any idea?

p.d. i use the eclipse plug-in and the 8900 simulator (on components 4.6.1)
p.p.d sorry for spanenglish
Offline  
Old 04-10-2009, 08:04 PM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Add the file to your project.

Use Class.forName() like this (modify for your package structure):

// get the data
Class cl = Class.forName("com.foo.Foobar.Foobar");

...then create an input stream:

// URL is in the form /text.xml
InputStream stream = cl.getResourceAsStream( getURL() );
dataInputStream = new DataInputStream(stream);
Offline  
Old 04-10-2009, 08:23 PM   #3
egirotto
Knows Where the Search Button Is
 
Join Date: Mar 2009
Location: Bilbao
Model: 8900
PIN: N/A
Carrier: Vodafone
Posts: 29
Default

thank for answer.

but the problem is that the config file must be editable (i will do a config screen where i can change the configuration of application and then write it to the xml).

if i save a file in the project i can open it only as input stream, correct?

i don't know if there is a better solution for this...
Offline  
Old 04-10-2009, 10:35 PM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

So? Save the modified XML file in the persistent store (as a String object).

Please take some time to look at the dozens of sample programs that ship with the BlackBerry JDE.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5 picture

OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5

$14.63



DELL 330-6581 3306581 725-10229 OEM LAMP FOR 1510X 1610HD 1610X  - Made By DELL picture

DELL 330-6581 3306581 725-10229 OEM LAMP FOR 1510X 1610HD 1610X - Made By DELL

$39.98



Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI picture

Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI

$94.99



New Genuine Dell OEM G Series G5 5590 Heatsink Assembly 35YK5 035YK5 1RGDW picture

New Genuine Dell OEM G Series G5 5590 Heatsink Assembly 35YK5 035YK5 1RGDW

$10.99



OEM Dell 3310 2 in 1 LCD Touch Screen D2TNH NV133FHM-T00 06GHX8 picture

OEM Dell 3310 2 in 1 LCD Touch Screen D2TNH NV133FHM-T00 06GHX8

$54.00



NEW DELL OEM REPLACEMENT PROJECTOR LAMP FOR 4220 4320 GENUINE ORIGINAL  picture

NEW DELL OEM REPLACEMENT PROJECTOR LAMP FOR 4220 4320 GENUINE ORIGINAL

$198.22







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.