In my application, I have a ViewSwitcher with two children:
<ViewFlipper
android:id="@+id/galeryviewflipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/galeryimageview_0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
/>
(... other stuff here)
</RelativeLayout>
<RelativeLayout>
(... copy previous except for IDs)
</RelativeLayout>
</ViewFlipper>
Then I switch the images in the gallery (each photo is 800x600 in size):
viewFlipper.setInAnimation(instance, R.anim.fade_in);
viewFlipper.setOutAnimation(instance, R.anim.fade_in);
viewFlipper.setDisplayedChild(nextIndex);
In Android 2.3.4, everything goes as expected, but on the 2.3.5 phone (Galaxy S2) dalvik calls GC several times during the animation, which leads to a sloppy user (pay attention to the GC time and duration!). I do not explicitly name System.gc anyhere in the application.
05-18 21:06:56.040: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 30ms
05-18 21:06:56.115: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 30ms
05-18 21:06:56.175: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 31ms
05-18 21:06:56.245: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 30ms
05-18 21:06:56.305: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 31ms
05-18 21:06:56.365: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 30ms
05-18 21:06:56.415: D/dalvikvm(6617): GC_EXTERNAL_ALLOC freed <1K, 50% free 5447K/10695K, external 17083K/17815K, paused 32ms
2.2+ ( s2), GC, . , OK , Galaxy S2, - - GC . - ? .
, Galaxy S2 5MB 64- . , , .