What is the use of BaseColumns in Android

后端 未结 4 2115
花落未央
花落未央 2020-11-30 05:25

What is the use of implementing a class from BaseColumns in Android?

4条回答
  •  既然无缘
    2020-11-30 06:13

    It is an interface, which looks like this

    public interface BaseColumns
    {
    
        public static final String _ID = "_id";
    
    
        public static final String _COUNT = "_count";
    }
    

    It contains constants like id and count used for auto-increment in SQL lite DB.

    We can also create our own constants for id without using this particular interface. But functions like cursor adaptor requires the exact constants like "_id", So it is better to use the provided interface!!

    Hope this helps you out!! :-)

提交回复
热议问题