BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-10-2009, 06: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, 08: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, 08: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, 10: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

VINTAGE EXCAVATING ENGINEER DEC, 1963 MAGAZINE
$8.0
VINTAGE EXCAVATING ENGINEER DEC, 1963 MAGAZINE pictureVINTAGE EXCAVATING ENGINEER MAGAZINE DEC. 1962
$9.5
VINTAGE EXCAVATING ENGINEER MAGAZINE DEC. 1962 pictureHSS 12PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP
$164.99
HSS 12PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP pictureTA004 Bestplus Cast Iron Dog Wall Hook/ Hats Bag Key Coat Vintage Hook, Home Dec
$29.76
TA004 Bestplus Cast Iron Dog Wall Hook/ Hats Bag Key Coat Vintage Hook, Home Dec pictureHSS 10PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP
$152.99
HSS 10PCS VALVE SEAT & FACE CUTTER 45DEC 30DEC 20DEC FOR VINTAGE CAR, BIKES,JEEP picture






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