zoukankan      html  css  js  c++  java
  • BaseColumns以及自定义Column

    android provider 包下自带的BaseColumn

    /*
     * Copyright (C) 2006 The Android Open Source Project
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *      http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    package android.provider;
    
    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";
    }

    基于basecolumn自定义自己表的Column

    public static final class PhoneLabelColumns implements BaseColumns {
    //必要的部分 ---begin-----
    public static final String TABLE = "phone_label"; public static final String COUNT = "count"; public static final String NUMBER = "number"; public static final String LABEL = "label";
    //必要的部分 ----end-----
    private static final String[] PROJECTION = { _ID, // 0 NUMBER, // 1 LABEL, // 2 COUNT, // 3 }; public static int COLUMN_NUMBER = 1; public static final int COLUMN_LABEL = 2; public static final int COLUMN_COUNT = 3; }
  • 相关阅读:
    2020 8 17 每日总结
    2020 8 9 每周总结
    2020 8 15 每日总结
    2020 8 13 每日总结
    2020 8 16 每日总结
    2020 811 每日总结
    2020 8 14 每日总结
    图的储存 各种方式的优缺点
    主席树 可持久化线段树基础知识入门详解
    NOIP复赛涉及面最广的知识点简述
  • 原文地址:https://www.cnblogs.com/0616--ataozhijia/p/3711136.html
Copyright © 2011-2022 走看看