Decks - Import/Export

This feature will give you a lot of flexibility in managing your Decks of Cards. Share them with your friends. Build them on your computer and copy them to your device.

The Decks of Cards are represented in XML format, but it's not complicated. See the Technical Stuff below for an explanation.

Import

To start, choose Import/Export | Import from the menu.

A file selection dialog will be presented allowing you to navigate to the location of your import file. It will initially open in the /data/data/com.ecsoftwareconsulting.TrulyRandom/files/ directory, unless your SD Card is not mounted, in which case it will start at the root of your file system.

Once you've selected your file, it will be read, presented as a list of the Decks of Cards found in the file. If it discovers one in the file that is named the same as one you already have, a sequence number will be appended to it so that it does not overwrite the one you have on the device already.

Choose any or all (at least one) of the Decks of Cards to import.

Export

To start, choose Import/Export | Export from the menu.

Enter a filename for your export and choose any or all (at least one) of your Decks of Cards to export. The file will be saved on the SD Card in the folder /data/data/com.ecsoftareconsulting.TrulyRandom/files.

Technical Stuff

This is a sample of what the XML looks like in order to represent a Deck of Cards.

Note: If you are having difficulties creating the file structure, try creating the Deck of Cards in the app and exporting it. Then you can compare the file exported with what you have and hopefully sort out any issues. Of course, you can always contact us and we will be glad to help.

Now for a little explanation. As you can imagine from the screen interface, a Deck of Cards is a hierarchy of items. Each deck has one or more cards. XML is well suited to represent this hierarchy. Each element that defines the Deck of Cards is represented by a tag.

Notice that for every element there is both an opening and closing tag. The element <card> defines the beginning of the definition for a card within the deck. So, when we have finished defining a card, we close that element using a slash "/" as follows: </card>.

The following will define the elements and what we expect to find in them.

<?xml version="1.0" encoding="utf-8"?>

This is just a header that XML files have which define some basic information about the version and content of the file. Just include this as the first line of your file (only once in the file) and don't worry about it beyond that.

<decks>

This element identifies the main body of the file. Everything that is being imported will be defined within the body of this element.

<deck>

This element identifies a Deck of Cards. The import file can contain multiple decks, so if you have more than one you want to add in the file, you would define multiple set elements.

<title>

The title element defines the title of each deck.

<card>

The card element collects the information necessary to define a card within the deck.

<name>

Name of the card or whatever text is necessary to define the purpose of the card.

<quantity>

The number of times this card appears in the deck.

Special Characters

As you can see, XML uses certain characters to identify its structural parts. As such, including those characters in the title and description elements will confuse the parser. So, to get around this, these special characters are "escaped" or replaced as follows: