0

Clicking on one of the tabs is causing delay of a second or two. Can't confirm that's the calculation delay or the garbage collector delay to free up the memory for a bitmap which is on that tab.

The log is having some dalvik processing to free up memory like -

04-02 11:45:58.109: D/dalvikvm(1930): GC_CONCURRENT freed 1638K, 21% free 15516K/19591K, paused 12ms+4ms, total 222ms

Is there a way to run Progress bar during the time the VM is freeing the memory for the bitmaps ?

This way the application user doesn't have to wait on a tab click as sometimes the delay is long enough that the user may think that nothing is happening.

sjain
  • 23,126
  • 28
  • 107
  • 185
  • 222 ms is 1/5th of a second. That can't make a delay of 2 seconds. –  Apr 02 '14 at 06:25
  • Sorry, the delay varies according to device and data. My mobile is slower than my tablet for this process. The above is for tablet. – sjain Apr 02 '14 at 06:29
  • I don't think you have a delay because of the GC. –  Apr 02 '14 at 06:47
  • The *total* time for the GC was 200ms. The *pause* time for the GC was in two pieces, one 12ms and one 4ms. The log shown in the question is not the cause of a second-or-two delay. – fadden Apr 02 '14 at 14:57

1 Answers1

-1

Use Asynctask concept in android , place user garbage clean in Doinbackgroud method , for example click here

Community
  • 1
  • 1
pavanmvn
  • 749
  • 10
  • 21
  • 1
    First of all you don't have control over GC. If you call System.gc(), that doesn't mean that GC will start. Also GC runs in a separate thread by itself. –  Apr 02 '14 at 06:38