Domanda

I'm writing an app version of a printed brochure. The brochure comes in multiple languages. In printed form (for a single language) it's only about 12 pages long.

The main screen on launching the app is a table of contents (TOC). Clicking on a TOC heading will open that "chapter" which is a 1-2 page section of the brochure. This will be a vertically-scrolling screen on the device. Swiping left/right will show the previous/next chapter of the brochure. I intend to have two activities: a TOCActivity and a DisplayChapterActivity which will display the content of whatever chapter it's told to.

The brochure is only updated every couple of years, and I want the data to be stored on the device so that the brochure is accessible even without connectivity. My plan is to have all language versions downloaded to the device when the app is installed, so that the user can switch to any version at any time. This is not a big demand on storage as the brochure is all text and isn't very long.

I know how to localize the app menus, title, etc. But what about the content of each "chapter", and what is the best way to store it? A chapter will have a few paragraphs, so they're not very long, but I think storing multi-line strings in the localized values/* XML files is a bad idea.

I see two options:

  1. Put the chapters in an SQL lite database.
  2. Put the chapters in separate text files

There are two parts to this question:

  1. Which of the above options is better for storage in this case?
  2. How do I tell the DisplayChapterActivity which language version to use when loading a chapter? Can this be linked to the locale used for internationalization or do I need an app-specific configuration option for that?

Note: This is the first app I've ever written. I'd be more than happy to clarify anything in my question if needed.

È stato utile?

Soluzione

1 - Which of the above options is better for storage in this case?

FILESYSTEM vs SQLITE, while storing up-to 10M files

It can help you to decide whether to go with SQLite or FileSytem.

2 - How do I tell the DisplayChapterActivity which language version to use when loading a chapter? Can this be linked to the locale used for internationalization or do I need an app-specific configuration option for that?

If you want to get the selected language of your device. This might help u

Locale.getDefault().getDisplayLanguage();

I hope my answer will lead you to a nice solution.

Thanks :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top