Note that there are some explanatory texts on larger screens.

plurals
  1. PODelay by Activity pause timeout for ActivityRecord when starting new activity
    primarykey
    data
    text
    <p>Whenever I start a new activity (even a plain, empty one) inside my app, I see a relatively large delay (1 to 2 seconds). Checking LogCat I see this:</p> <pre><code>// This is a transition from CurrentActivity to NewActivity 03-01 14:59:00.195: I/ActivityManager(515): START {act=android.intent.action.GET_CONTENT ...} from pid 9382 03-01 14:59:00.242: D/NewActivity(9382): Intent started 03-01 14:59:00.242: D/CurrentActivity(9382): Activity.onPause 03-01 14:59:00.359: D/dalvikvm(515): GC_CONCURRENT freed 824K, 20% free 10419K/12871K, paused 2ms+12ms 03-01 14:59:00.476: I/cat(416): &lt;4&gt;[22335.131317] CPU1: Booted secondary processor 03-01 14:59:00.476: I/cat(416): &lt;6&gt;[22335.138885] Switched to NOHz mode on CPU #1 03-01 14:59:00.742: W/ActivityManager(515): Activity pause timeout for ActivityRecord{4131c158 CURRENT-ACTIVITY} 03-01 14:59:01.179: D/dalvikvm(9382): GC_CONCURRENT freed 1562K, 68% free 10961K/33415K, paused 2ms+6ms 03-01 14:59:01.937: D/NewActivity(9382): NewActivity.onCreate </code></pre> <p>Note that everything works OK, no crashes, just this weird delay. If I put the code from the activity in a <code>DialogFragment</code> and show the dialog, it is virtually instant. Only when the code runs in a separate Activity there's this delay. The code running inside the <code>CurrentActivity.onPause</code> is minimal and not resposible for the delay.</p> <p>Addition: the above is when running under android <code>API14</code>. Android 2.2 (API) on a different device shows the same delay but with a slightly different <code>LogCat</code>:</p> <pre><code>I/ActivityManager(2473): Starting activity: Intent { act=android.intent.action.GET_CONTENT cmp=NewActivity } 03-01 15:08:06.537: D/Editor(4591): Activity.onSaveInstanceState 03-01 15:08:06.537: D/Editor(4591): Activity.onPause 03-01 15:08:06.595: V/InputDevice(2473): ID[0]=0(0) Up(1=&gt;0) 03-01 15:08:07.033: W/ActivityManager(2473): Activity pause timeout for HistoryRecord{CurrentActivity} 03-01 15:08:07.873: D/dalvikvm(4591): GC_FOR_MALLOC freed 5867 objects / 421464 bytes in 33ms 03-01 15:08:08.720: D/NewActivity(4591): NewActivity.onCreate </code></pre> <p>This is how I create and start the NewActivity: Intent intent = new Intent(this, ImagePickerActivity.class); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(intent, ACTIVITY_RESULT_ADD_IMAGE);</p> <p>The CurrentActivity is too large to post.</p> <p>Any idea what is causing this and how to prevent it?</p> <p>Thanks in advance,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload