Dunkey
Dunkey

Reputation: 1922

android dictionary application with offline database

I want to develop an android English dictionary application that uses only an offline database. By that, I mean to say that it doesn't have to be redirected to online dictionary like WordWeb or the like. Does anybody know what should I do to store my words? I'm thinking of using SQLite since it's mobile. But if anyone here already has done or did something what I want to do, can you give me some expert suggestions?

Upvotes: 6

Views: 37355

Answers (6)

Syamantak Basu
Syamantak Basu

Reputation: 935

http://developer.android.com/resources/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryDatabase.html

I have used this code from developer.android.com . Hope it will help you also.

EDIT: This page is no longer available, but the example itself is on Github here.

Upvotes: 6

Ujjwal Kumar Gupta
Ujjwal Kumar Gupta

Reputation: 2376

The best approach is that - keep your data in files say in json file and keep it on the web or you can also uplaod this on googledrive or dropbox and make it public and after that when user will open the app for first time, download the json files and insert the data from json into sql lite db.This way you can use sql lite for offline data.

Upvotes: 0

Walid Fouad
Walid Fouad

Reputation: 21

I already did this to my dictionaries:

https://play.google.com/store/apps/developer?id=e-Biene%20DEV&hl=en

You can make conversion to your simple database, tblLanguage1[word, translation] tblLanguage2[word, translation]

to (SQLite format [extract it from emulator], and then attach this converted SQLite db with your App offline).

It will be quick and fast for searching.

and Use: DB created in emulator with structure like: Tables:

lang1_Content lang1_segments lang1_segdir

use this instead of simple.

Upvotes: 1

teoREtik
teoREtik

Reputation: 7916

Your primary problem is to specify what essential will store your dictionary.

There are a lot of ways provided by Android to store your data such like:

  • SharedPreferences
  • File saved in device's internal storage or external storage
  • SQLite database
  • You also may create a static database and store it in your assets folder as described in this post.

    Also you may check for Searchable Dictionary from android-samples which is a good example of implementing a search for your app and also there described some technics of storing data.

    Upvotes: 0

    Ray Foss
    Ray Foss

    Reputation: 3883

    Try the Google API samples, I know they have a Dictionary application. I'm pretty sure it's offline too. I had to build something with an offline cache, I used JAVA's excellent XML parser to load things into the SQLite database. When the user had an internet connection, it would download a new XML and use that to update the database. You can store any type of file with your application however.

    http://developer.android.com/tools/samples/index.html The sample I'm talking about is called Searchable Dictionary.

    Upvotes: 0

    Zsombor Erdődy-Nagy
    Zsombor Erdődy-Nagy

    Reputation: 16914

    I'd go with using SQLite, that's probably the easiest and most straightforward way to do it on Android. Of course the complexity of this solution depends on you exact needs. If you only need a really simple dictionary, then you could get away with a simple db schema with basic queries.

    Another thing that comes to mind is the Trie data structure, you may want to look into that: http://en.wikipedia.org/wiki/Trie#Dictionary_representation . But it probably wouldn't worth the hassle to pull this off using this, I'd guess that the performance of the SQLite solution is more than enough for your needs.

    Upvotes: 1

    Related Questions