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

Frieling Emsa Soft Grip Carafe Blackberry
$57.57
Frieling Emsa Soft Grip Carafe Blackberry pictureBlack & Berry Marble Cutting Machine, BB-2605, 1050W, 12000rpm
$70.78
Black & Berry Marble Cutting Machine, BB-2605, 1050W, 12000rpm picture1p PM8058 BGA IC Chip for BlackBerry Bold Touch 9900 LT15 MT15 LT18
$6.5
1p PM8058 BGA IC Chip for BlackBerry Bold Touch 9900 LT15 MT15 LT18 pictureNite Ize BHC2-03-01 Black Ballistic Nylon Blackberry Hard-Shell Case
$15.28
Nite Ize BHC2-03-01 Black Ballistic Nylon Blackberry Hard-Shell Case pictureHouse of Doolittle EcoTones Monthly Desk Pad Calendar Blackberry
$16.99
House of Doolittle EcoTones Monthly Desk Pad Calendar Blackberry picture






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