Reputation: 3788
I'm trying to store a create database script (a rather lengthy one) in the strings.xml file (noobie here, haven't figured out a better place to put it yet) it does show up in the generated R class:
public static final class string {
public static final int app_name=0x7f040001;
public static final int create_database=0x7f040002; //this one here
public static final int hello=0x7f040000;
}
but when I try this in the code:
DATABASE_CREATE = R.string.create_database;
'create_database' is not available. Ti's simply not there, I get an error if I try to use it. Any ideas why this is so? Do those strings have length limitations? Can they only consist of a single line? If that's the case, what's the right place to put my SQL create script? Thanks for your answers.
Upvotes: 1
Views: 1785
Reputation: 1045
R.string.create_database
in the generated R
is an integer (see your line with the comment). In order to get the string value, you need to call getString(R.string.create_database)
. See getString(int)
Upvotes: 2