BaseColumns在Android中有什么用 [英] What is the use of BaseColumns in Android

查看:29
本文介绍了BaseColumns在Android中有什么用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android 中从 BaseColumns 实现一个类有什么用?

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 列,该列可自动递增并可用作主键.这也很好地与 ContentProviders

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

这篇关于BaseColumns在Android中有什么用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆