我正在使用 viewpagerindicator 作为我的 android 应用程序的一部分。fragmentAdapter 的 getPageTitle 在页面的每张幻灯片上被调用太多次。我使用作为 viewpagerindicator 的一部分提供的示例应用程序对其进行了验证。
作为 viewpagerindicator 的一部分提供的示例应用程序只有 4 个片段/页面。但是在每张幻灯片之后,每个位置都会调用 getPageTitle 几乎 10 到 15 次。记录器语句附有输出。
有没有办法避免这种情况?
@Override
public CharSequence getPageTitle(int position) {
Log.d("SAMPLE","Title Getting called for "+position);
return TestFragmentAdapter.CONTENT[position % CONTENT.length];
}
08-07 13:02:09.835: D/BatteryService(1501): update start
08-07 13:02:10.421: I/InputReader(1501): dispatchTouch::touch event's action is 0
08-07 13:02:10.421: I/InputDispatcher(1501): Delivering touch to current input target
08-07 13:02:10.421: D/PowerManagerService(1501): reactivateScreenLocksLocked mProxIgnoredBecauseScreenTurnedOff=false
08-07 13:02:10.421: I/PowerManagerService(1501): Ulight 1->3|0
08-07 13:02:10.437: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.437: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.445: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.445: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.445: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.445: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.445: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.445: D/SurfaceFlinger(1501): Layer[332660] [35] non-RGB565 reloads
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.460: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.476: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.476: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.476: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.484: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.484: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.484: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.484: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.500: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.515: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.539: I/InputReader(1501): dispatchTouch::touch event's action is 1
08-07 13:02:10.539: I/InputDispatcher(1501): Delivering touch to current input target
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.562: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.570: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.585: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.593: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.593: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.593: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.593: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.593: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.601: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.609: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.617: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.617: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.617: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.625: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.625: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.625: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.632: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.632: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.632: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.632: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.640: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.640: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.648: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.656: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.656: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.656: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.656: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.664: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.664: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.671: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.671: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.671: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.671: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.671: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.679: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.687: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.687: I/PowerManagerService(1501): Light Animator Finished curIntValue=143
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.695: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.703: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.703: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.703: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.703: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.710: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.710: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.718: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.726: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.734: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.734: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.734: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.734: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.742: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.742: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.765: D/SAMPLE(28147): Title Getting called for 0
08-07 13:02:10.765: D/SAMPLE(28147): Title Getting called for 1
08-07 13:02:10.773: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.773: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:10.773: D/SAMPLE(28147): Title Getting called for 2
08-07 13:02:10.773: D/SAMPLE(28147): Title Getting called for 3
08-07 13:02:11.421: D/wpa_supplicant(1637): CMD: DRIVER RSSI-APPROX
08-07 13:02:11.445: D/wpa_supplicant(1637): wpa_driver_priv_driver_cmd buf = xxxxxxxx len = 15, 15
08-07 13:02:11.445: D/wpa_supplicant(1637): CMD: DRIVER LINKSPEED
08-07 13:02:11.445: D/wpa_supplicant(1637): wpa_driver_priv_driver_cmd buf = xxxxxxxx len = 12, 12