public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
initBugly();
initBaiduMap();
initJPushInterface();
initShareSDK();
…
}
private void initBugly() throws InterruptedException {
Thread.sleep(1000); // 模拟耗费的时间
}
private void initBaiduMap() throws InterruptedException {
Thread.sleep(2000); // 模拟耗费的时间
}
private void initJPushInterface() throws InterruptedException {
Thread.sleep(3000); // 模拟耗费的时间
}
private void initShareSDK() throws InterruptedException {
Thread.sleep(500); // 模拟耗费的时间
}
}
代码不用我说,项目中很常见,现在的问题是APP启动加载很慢, 那么如何精准的查询到具体耗时的方法?
long startTime = System.currentTimeMillis();
initBugly();
Log.d(“lybj”, “initBugly()方法耗时:”+ (System.currentTim