如何使用内部抽象类而不在android中的另一个类中使用其父类名

时间:2015-09-01 10:22:08

标签: java android database sqlite inner-classes

public final class FeedReaderContract {
// To prevent someone from accidentally instantiating the contract class,
// give it an empty constructor.
public FeedReaderContract() {}

/* Inner class that defines the table contents */
public static abstract class FeedEntry implements BaseColumns {
    public static final String TABLE_NAME = "entry";
    public static final String COLUMN_NAME_ENTRY_ID = "entryid";
    public static final String COLUMN_NAME_TITLE = "title";
    public static final String COLUMN_NAME_SUBTITLE = "subtitle";
    ...
}

}

当我做的时候

private static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + FeedEntry.TABLE_NAME + " (" +
FeedEntry._ID + " INTEGER PRIMARY KEY," +
FeedEntry.COLUMN_NAME_ENTRY_ID + TEXT_TYPE + COMMA_SEP +
FeedEntry.COLUMN_NAME_TITLE + TEXT_TYPE + COMMA_SEP +
... // Any other options for the CREATE command
" )";

我无法直接使用FeedEntry。我必须使用FeedReaderContract.FeedEntry.COLUMN_NAME而不是FeedEntry.COLUMN_NAME。 如何直接使用FeedEntry ??

0 个答案:

没有答案