My activity (that uses camera) starts quite slowly, according to Logcat:
08-21 21:51:56.672: I/ActivityManager(488): Displayed com.blabla/.activities.TakePhotoActivity: +1s472ms
So I decided to use method profiling to see where the problem is (this is where the slow Activity is started):
public void onClick(View v) {
Debug.startMethodTracing();
Intent intent = new Intent(getApplicationContext(), TakePhotoActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left);
}
and in onResume in TakePhotoActivity I call:
protected void onResume() {
super.onResume();
cameraView.onResume();
Debug.stopMethodTracing();
}
But, to my surprise, Traceview shows only 260ms of method calls, so I'm losing over 1 second somewhere!
How do I find out what is happening during this time?
Here is a good tutorial about how to use trace view on Android application.Just run it and check which all sub methods are causing the time lose.It has a nice visual representation of time usage.