您好我想尝试为Android手机制作一个简单的应用程序,我需要一本字典。我想过使用urbandictionary.com作为参考站点。是否有任何技术可以用词典中的定义及其各自的单词提取所有单词?
答案 0 :(得分:1)
我正在查看
中找到的Google示例http://developer.android.com/resources/samples/SearchableDictionary/index.html
看起来他们只是用这个例子添加他们的话
private void loadWords() throws IOException {
Log.d(TAG, "Loading words...");
final Resources resources = mHelperContext.getResources();
InputStream inputStream = resources.openRawResource(R.raw.definitions);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
try {
String line;
while ((line = reader.readLine()) != null) {
String[] strings = TextUtils.split(line, "-");
if (strings.length < 2) continue;
long id = addWord(strings[0].trim(), strings[1].trim());
if (id < 0) {
Log.e(TAG, "unable to add word: " + strings[0].trim());
}
}
} finally {
reader.close();
}
Log.d(TAG, "DONE loading words.");
}
但是,当我查找R.raw.definitions时,该目录为空。
http://developer.android.com/resources/samples/SearchableDictionary/res/raw/index.html