Android开发经验转载

不是原创、转载自他人

批量地插入数据的方法 转载自:https://www.jianshu.com/p/a3aae513939b

解决由隐式事务开启的消耗!主动地开启事务

//假设strings.size() = 10000
try {
        mDb.beginTransaction();
        for (String data : strings) {
            ContentValues contentValues = new ContentValues();
            if(!TextUtils.isEmpty(data)){
                contentValues.put(key, data);
            }
            mDb.insert(table_name, null, contentValues);
        }
        mDb.setTransactionSuccessful();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        mDb.endTransaction();
        mDb.close();
    }

建立数据库索引、优化查询

转载自: https://blog.csdn.net/chu_qun/article/details/3719532

超级详细的Assets解释

转载自: https://blog.csdn.net/u012005313/article/details/71268254

gradle技巧

配置国内的源、加快下载

// Top-level build file where you can add configuration options common to all sub-projects/modules.
//
//buildscript {
//    repositories {
//        google()
//        jcenter()
//
//    }
//    dependencies {
//        classpath 'com.android.tools.build:gradle:3.5.2'
//
//        // NOTE: Do not place your application dependencies here; they belong
//        // in the individual module build.gradle files
//    }
//}
//
//allprojects {
//    repositories {
//        google()
//        jcenter()
//
//    }
//}
//
//
//task clean(type: Delete) {
//    delete rootProject.buildDir
//}

buildscript {

    repositories {

        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()

    }

     dependencies {

         classpath 'com.android.tools.build:gradle:3.5.2'

       // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
    }

}

allprojects {

    repositories {

        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
        google()

    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值