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

100% Genuine Apple OEM EarPods with Remote and Mic with TrendON Headphone cell p
$20.79
100% Genuine Apple OEM EarPods with Remote and Mic with TrendON Headphone cell p pictureNEW OEM Original Genuine Apple MacBook Pro 13 A1278 2009 2010 2011 US Keyboard &
$34.79
NEW OEM Original Genuine Apple MacBook Pro 13 A1278 2009 2010 2011 US Keyboard & pictureLot of 3 - Apple Imagewriter II Ribbons - OEM Apple Brand, Sealed in Plastic
$18.95
Lot of 3 - Apple Imagewriter II Ribbons - OEM Apple Brand, Sealed in Plastic pictureGM ACDELCO - STEM APPL VALVE BODY 2063655 - GM ACDELCO OEM
$46.0
GM ACDELCO - STEM APPL VALVE BODY 2063655 - GM ACDELCO OEM pictureGM ACDELCO - PIN PKG INTER BAND APPL 8632975 - GM ACDELCO OEM
$46.0
GM ACDELCO - PIN PKG INTER BAND APPL 8632975 - GM ACDELCO OEM picture






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