android定义内部类,android – FeedReaderContract的目的是什么以及如何在OpenHelper类中定义内部类...

汝岳
2023-12-01

我理解为:

public static class FeedReaderContract{

// Prevents the FeedReaderContract class from being instantiated.

private FeedReaderContract() {}

//The FeedEntry table definition

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";

...

}

//more tables definition

}

因此,您无法实现合同,但可以访问所有内部类Constants.像示例行:

private static final String sql_CREATE_ENTRIES =

"CREATE TABLE " + FeedReaderContract.FeedEntry.TABLE_NAME + " (" +

FeedReaderContract.FeedEntry._ID + " INTEGER PRIMARY KEY," //continues

访问FeedReaderContract类中内部类的FeedEntry常量(TABLE_NAME和_ID).

希望能帮助到你.

 类似资料: