BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-10-2009, 07:11 PM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2009
Location: Bilbao
Model: 8900
PIN: N/A
Carrier: Vodafone
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 09:04 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
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, 09:23 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2009
Location: Bilbao
Model: 8900
PIN: N/A
Carrier: Vodafone
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
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, 11:35 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
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


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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