什么是使用Android中BaseColumns的Android、BaseColumns

2023-09-12 07:34:39 作者:太狼狈

我想知道,有什么用Android中实现从BaseColumns的一类。

I want to know that , what is the use of implementing a class from BaseColumns in android.

推荐答案

这是一个简单的接口,其将两个领域:

This is a simple interface which adds two fields :

public interface BaseColumns
{
    /**
     * The unique ID for a row.
     * <P>Type: INTEGER (long)</P>
     */
    public static final String _ID = "_id";

    /**
     * The count of rows in a directory.
     * <P>Type: INTEGER</P>
     */
    public static final String _COUNT = "_count";
}

在Android中使用的内部SQLite数据库,他们配备了 _id 列自动递增,并且可以作为主键的功能。这也映射以及与的ContentProvider 取值

Internally sqlite databases used in Android they come with a _id column that autoincrements and can function as a primary key. This also maps well with ContentProviders