Back to project page OrzEye.
The source code is released under:
GNU General Public License
If you think the Android project OrzEye listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dylan.orzeye.dictionary; /*from ww w . ja v a 2 s. co m*/ import java.io.File; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Environment; public class DictionaryTool { public static final String DATABASE_PATH = Environment .getExternalStorageDirectory().toString() + "/OrzEye" + "/dictionary/"; private final String DATABASE_FILENAME = "dictionary.db"; private SQLiteDatabase database = null; public DictionaryTool() { database = openDatabase(); } private SQLiteDatabase openDatabase() { String databaseFilename = DATABASE_PATH + DATABASE_FILENAME; if ((new File(databaseFilename)).exists()) { database = SQLiteDatabase.openOrCreateDatabase(databaseFilename, null); } return database; } public String lookUpDictionary(String recognizedText) { String sql = "select chinese from t_words where english=?"; Cursor cursor = database.rawQuery(sql, new String[] { recognizedText }); String result = "not found!"; if (cursor.getCount() > 0) { cursor.moveToFirst(); result = cursor.getString(cursor.getColumnIndex("chinese")); } return result; } public boolean isDictionaryReady() { return database == null ? false : true; } }