Android 从网站中提取单词
嗨,我想尝试为android手机制作一个简单的应用程序,我需要一本字典。我想用urbandictionary.com作为参考网站。有没有什么技巧可以让我提取出所有的单词以及它们在同义词库中的定义和各自的单词 我正在查看在 似乎他们只是在这个例子中加上了自己的话Android 从网站中提取单词,android,Android,嗨,我想尝试为android手机制作一个简单的应用程序,我需要一本字典。我想用urbandictionary.com作为参考网站。有没有什么技巧可以让我提取出所有的单词以及它们在同义词库中的定义和各自的单词 我正在查看在 似乎他们只是在这个例子中加上了自己的话 private void loadWords() throws IOException { Log.d(TAG, "Loading words..."); final Resources
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.");
}
private void loadWords()引发IOException{
Log.d(标签“加载单词…”);
final Resources Resources=mhelpocontext.getResources();
InputStream InputStream=resources.openRawResource(R.raw.definitions);
BufferedReader reader=新的BufferedReader(新的InputStreamReader(inputStream));
试一试{
弦线;
而((line=reader.readLine())!=null){
String[]strings=TextUtils.split(第“-”行);
如果(字符串长度<2)继续;
long id=addWord(字符串[0].trim(),字符串[1].trim());
if(id<0){
Log.e(标记“无法添加单词:”+strings[0].trim());
}
}
}最后{
reader.close();
}
Log.d(标记“完成加载单词”);
}
但是,当我查找R.raw.definitions时,该目录是空的