Android: Searchable Dictionary error: (R.raw.definitions)
I am new to android and I started this sample from google but i have a problem and couldn't get pass it.
This line has an error in DictonaryDatabase.java.
InputStream inputStream = resources.openRawResource(R.raw.definitions);
and the error says "raw cannot be resolved or is not in a field."
I have imported开发者_StackOverflow中文版 the Java.R but this didn't seem to fix it. I also have created a raw folder but didn't fix it.
thanks for your help.
you need to add definitions.txt. file directory should luk like this /res/raw/definitions.txt .It is just soft copy of dictionary.
and copy below texts inside that definition.txt file
i entered just 'A' and 'B' letters. If u get any text of dictionary words just copy those words till letter 'Z' in this definition file
abbey - n. a monastery ruled by an abbot
abide - v. dwell; inhabit or live in
abound - v. be abundant or plentiful; exist in large quantities
absence - n. the state of being absent
absorb - v. assimilate or take in
abstinence - n. practice of refraining from indulging an appetite especially alcohol
absurd - j. inconsistent with reason or logic or common sense
boycott - n. a group's refusal to have commercial dealings with some organization in
breach - n. an opening (especially a gap in a dike or fortification)
caricature - n. a representation of a person that is exaggerated for comic effect
casual - j. without or seeming to be without plan or method; offhand
I just solved it removing this line
import android.R;
R
is a special class holding identifiers of all your resources. It is automatically generated to match the content of your res folder. According to your error, you haven't added raw/definitions to your res folder. You are trying to access a non-existent resource.
it seems you need
import android.R;
精彩评论