我正在使用毕加索作为我的应用。它的工作正常但是花费了太多时间将图像显示到ImageView中。任何人都可以告诉我是什么原因,我该如何解决?
我正在使用此代码:
Picasso.with(image.getContext())
.load(imageIds[currentIndex])
.transform(new BitmapTransform(MAX_WIDTH, MAX_HEIGHT))
.skipMemoryCache()
.resize(size, size)
.centerInside()
.into(image);
其中MAX_WIDTH和MAX_HEIGHT声明为:
private static final int MAX_WIDTH = 1000;
private static final int MAX_HEIGHT = 700;
,代码是:
public class BitmapTransform implements Transformation {
int maxWidth;
int maxHeight;
public BitmapTransform(int maxWidth, int maxHeight) {
this.maxWidth = maxWidth;
this.maxHeight = maxHeight;
}
@Override
public Bitmap transform(Bitmap source) {
int targetWidth, targetHeight;
double aspectRatio;
if (source.getWidth() > source.getHeight()) {
targetWidth = maxWidth;
aspectRatio = (double) source.getHeight() / (double) source.getWidth();
targetHeight = (int) (targetWidth * aspectRatio);
} else {
targetHeight = maxHeight;
aspectRatio = (double) source.getWidth() / (double) source.getHeight();
targetWidth = (int) (targetHeight * aspectRatio);
}
Bitmap result = Bitmap.createScaledBitmap(source, targetWidth, targetHeight, false);
if (result != source) {
source.recycle();
}
return result;
}
@Override
public String key() {
return maxWidth + "x" + maxHeight;
}
};
添加setLoggingEnabled(true)后,日志如下: 由于字数限制,无法显示完整的日志。
08-12 05:20:52.270 383-406/system_process W/ActivityManager﹕ No content provider found for permission revoke: file:///data/local/tmp/com.kidooz.kidooz_abcfun
08-12 05:20:56.670 383-406/system_process W/ActivityManager﹕ No content provider found for permission revoke: file:///data/local/tmp/com.kidooz.kidooz_abcfun
08-12 05:21:04.650 383-398/system_process I/ActivityManager﹕ Force stopping com.kidooz.kidooz_abcfun appid=10055 user=-1: uninstall pkg
08-12 05:21:04.950 383-406/system_process I/PackageManager﹕ Package com.kidooz.kidooz_abcfun codePath changed from /data/app/com.kidooz.kidooz_abcfun-2.apk to /data/app/com.kidooz.kidooz_abcfun-1.apk; Retaining data and using new
08-12 05:21:04.980 383-406/system_process I/PackageManager﹕ Running dexopt on: com.kidooz.kidooz_abcfun
08-12 05:21:08.270 383-406/system_process W/PackageManager﹕ Code path for pkg : com.kidooz.kidooz_abcfun changing from /data/app/com.kidooz.kidooz_abcfun-2.apk to /data/app/com.kidooz.kidooz_abcfun-1.apk
08-12 05:21:08.270 383-406/system_process W/PackageManager﹕ Resource path for pkg : com.kidooz.kidooz_abcfun changing from /data/app/com.kidooz.kidooz_abcfun-2.apk to /data/app/com.kidooz.kidooz_abcfun-1.apk
08-12 05:21:08.310 383-398/system_process I/ActivityManager﹕ Force stopping com.kidooz.kidooz_abcfun appid=10055 user=-1: update pkg
08-12 05:21:08.850 383-406/system_process I/ActivityManager﹕ Force stopping com.kidooz.kidooz_abcfun appid=10055 user=0: pkg removed
08-12 05:21:09.450 383-383/system_process D/BackupManagerService﹕ Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.kidooz.kidooz_abcfun flg=0x4000010 (has extras) }
08-12 05:21:09.800 383-383/system_process D/BackupManagerService﹕ Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.kidooz.kidooz_abcfun flg=0x4000010 (has extras) }
08-12 05:21:17.090 383-620/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.kidooz.kidooz_abcfun/.logo} from pid 882
08-12 05:21:17.700 383-565/system_process I/ActivityManager﹕ Start proc com.kidooz.kidooz_abcfun for activity com.kidooz.kidooz_abcfun/.logo: pid=892 uid=10055 gids={50055}
08-12 05:21:20.370 892-892/com.kidooz.kidooz_abcfun W/Settings﹕ Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
08-12 05:21:20.580 892-892/com.kidooz.kidooz_abcfun E/MediaPlayer﹕ Should have subtitle controller already set
08-12 05:21:20.830 892-892/com.kidooz.kidooz_abcfun D/﹕ HostConnection::get() New Host Connection established 0xb7f45bb0, tid 892
08-12 05:21:21.390 892-892/com.kidooz.kidooz_abcfun W/EGL_emulation﹕ eglSurfaceAttrib not implemented
08-12 05:21:21.490 892-892/com.kidooz.kidooz_abcfun D/OpenGLRenderer﹕ Enabling debug mode 0
08-12 05:21:23.520 383-397/system_process I/ActivityManager﹕ Displayed com.kidooz.kidooz_abcfun/.logo: +6s87ms
08-12 05:21:23.600 383-620/system_process I/ActivityManager﹕ START u0 {cmp=com.kidooz.kidooz_abcfun/.Main} from pid 892
08-12 05:21:24.900 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 125K, 7% free 3195K/3404K, paused 81ms, total 95ms
08-12 05:21:25.020 892-892/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 10.050MB for 7200016-byte allocation
08-12 05:21:25.180 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 4K, 3% free 10221K/10436K, paused 150ms, total 150ms
08-12 05:21:26.070 892-892/com.kidooz.kidooz_abcfun E/MediaPlayer﹕ Should have subtitle controller already set
08-12 05:21:26.520 892-892/com.kidooz.kidooz_abcfun W/EGL_emulation﹕ eglSurfaceAttrib not implemented
08-12 05:21:29.120 383-397/system_process W/WindowManager﹕ This window was lost: Window{b404c400 u0 com.kidooz.kidooz_abcfun/com.kidooz.kidooz_abcfun.logo}
08-12 05:21:29.120 383-397/system_process W/WindowManager﹕ mDisplayId=0 mSession=Session{b4008bc8 892:u0a10055} mClient=android.os.BinderProxy@b4004d38
mOwnerUid=10055 mShowToOwnerOnly=true package=com.kidooz.kidooz_abcfun appop=NONE
mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#120 ty=1 fl=#1810100 pfl=0x8 wanim=0x1030001}
Requested w=1200 h=1824 mLayoutSeq=56
mBaseLayer=21000 mSubLayer=0 mAnimLayer=21005+0=21005 mLastLayer=21010
mToken=AppWindowToken{b40f75e8 token=Token{b3fa80a8 ActivityRecord{b4022c80 u0 com.kidooz.kidooz_abcfun/.logo t2}}}
mRootToken=AppWindowToken{b40f75e8 token=Token{b3fa80a8 ActivityRecord{b4022c80 u0 com.kidooz.kidooz_abcfun/.logo t2}}}
mAppToken=AppWindowToken{b40f75e8 token=Token{b3fa80a8 ActivityRecord{b4022c80 u0 com.kidooz.kidooz_abcfun/.logo t2}}}
mViewVisibility=0x0 mHaveFrame=true mObscured=false
mSeq=0 mSystemUiVisibility=0x0
mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]
mConfiguration={1.0 310mcc260mnc en_US ldltr sw600dp w600dp h887dp 320dpi lrg port finger qwerty/v/v -nav/h s.5}
mHasSurface=true mShownFrame=[0.0,0.0][1200.0,1824.0] isReadyForDisplay()=false
mFrame=[0,0][1200,1824] last=[0,0][1200,1824]
mSystemDecorRect=[0,50][1200,1824] last=[0,50][1200,1824]
Frames: containing=[0,0][1200,1824] parent=[0,0][1200,1824]
display=[0,0][1200,1824] overscan=[0,0][1200,1920]
content=[0,50][1200,1824] visible=[0,50][1200,1824]
decor=[0,50][1200,1824]
Cur insets: overscan=[0,0][0,0] content=[0,50][0,0] visible=[0,50][0,0]
Lst insets: overscan=[0,0][0,0] content=[0,50][0,0] visible=[0,50][0,0]
WindowStateAnimator{b40e85e0 com.kidooz.kidooz_abcfun/com.kidooz.kidooz_abcfun.logo}:
mSurface=Surface(name=com.kidooz.kidooz_abcfun/com.kidooz.kidooz_abcfun.logo)
mDrawState=HAS_DRAWN mLastHidden=true
Surface: shown=false layer=21010 alpha=1.0 rect=(0.0,0.0) 1200.0 x 1824.0
mGlobalScale=1.0 mDsDx=1.0 mDtDx=0.0 mDsDy=0.0 mDtDy=1.0
mExiting=false mRemoveOnExit=false mDestroying=true mRemoved=false
08-12 05:21:29.180 383-397/system_process V/WindowManager﹕ #1: Token{b4008718 ActivityRecord{b40f9f48 u0 com.kidooz.kidooz_abcfun/.Main t2}}
08-12 05:21:29.180 383-397/system_process V/WindowManager﹕ #5: Window{b40909f8 u0 com.kidooz.kidooz_abcfun/com.kidooz.kidooz_abcfun.Main}
08-12 05:21:30.620 383-397/system_process I/ActivityManager﹕ Displayed com.kidooz.kidooz_abcfun/.Main: +6s697ms
08-12 05:21:30.870 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 7K, 2% free 12020K/12196K, paused 52ms, total 61ms
08-12 05:21:35.300 383-656/system_process I/ActivityManager﹕ START u0 {act=com.kidooz.kidooz_abcfun.AA cmp=com.kidooz.kidooz_abcfun/.aa} from pid 892
08-12 05:21:36.190 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 2138K, 19% free 10318K/12588K, paused 73ms, total 86ms
08-12 05:21:36.340 892-892/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 14.140MB for 4194320-byte allocation
08-12 05:21:36.460 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 14% free 14413K/16688K, paused 117ms, total 117ms
08-12 05:21:37.760 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 14% free 14413K/16688K, paused 86ms, total 87ms
08-12 05:21:37.920 892-892/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 18.139MB for 4194320-byte allocation
08-12 05:21:38.020 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 11% free 18509K/20788K, paused 103ms, total 103ms
08-12 05:21:39.390 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 11% free 18510K/20788K, paused 100ms, total 103ms
08-12 05:21:39.540 892-892/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 22.140MB for 4194320-byte allocation
08-12 05:21:40.250 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 10% free 22606K/24888K, paused 91ms, total 92ms
08-12 05:21:40.280 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R1]+5ms
08-12 05:21:40.290 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R1]+18ms
08-12 05:21:40.990 892-892/com.kidooz.kidooz_abcfun W/EGL_emulation﹕ eglSurfaceAttrib not implemented
08-12 05:21:44.180 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 43K, 10% free 22591K/24888K, paused 125ms, total 126ms
08-12 05:21:44.380 892-917/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.125MB for 4194320-byte allocation
08-12 05:21:44.470 383-397/system_process I/ActivityManager﹕ Displayed com.kidooz.kidooz_abcfun/.aa: +9s74ms
08-12 05:21:44.570 892-892/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26686K/28988K, paused 115ms, total 118ms
08-12 05:21:45.120 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R1]+4847ms
08-12 05:21:45.130 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R1]+4851ms for completion
08-12 05:21:45.340 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R1]+5s
08-12 05:21:45.350 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R1]+5s from DISK
08-12 05:21:46.490 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 66 frames! The application may be doing too much work on its main thread.
08-12 05:21:49.410 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R2] Request{2130837592 1000x700 resize(837,837) centerInside}
08-12 05:21:50.050 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R2]+678ms
08-12 05:21:50.380 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R2]+1006ms
08-12 05:21:51.620 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 4109K, 10% free 22597K/24852K, paused 70ms, total 72ms
08-12 05:21:51.670 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.130MB for 4194320-byte allocation
08-12 05:21:52.110 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26692K/28952K, paused 64ms, total 64ms
08-12 05:21:52.110 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R2]+2737ms
08-12 05:21:52.190 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26692K/28952K, paused 70ms, total 70ms
08-12 05:21:52.220 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.803MB for 2802292-byte allocation
08-12 05:21:52.300 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29429K/31692K, paused 73ms, total 73ms
08-12 05:21:52.530 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R2]+3155ms
08-12 05:21:52.580 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R2]+3206ms from custom transformations
08-12 05:21:52.590 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R2]+3209ms for completion
08-12 05:21:52.800 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R2]+3418ms from DISK
08-12 05:21:52.830 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R2]+3453ms
08-12 05:21:53.360 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 31 frames! The application may be doing too much work on its main thread.
08-12 05:21:55.170 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R3] Request{2130837594 1000x700 resize(837,837) centerInside}
08-12 05:21:55.210 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R3]+23ms
08-12 05:21:55.360 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R3]+16ms
08-12 05:21:56.190 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8760K, 10% free 22598K/24852K, paused 95ms, total 106ms
08-12 05:21:56.310 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.132MB for 4194320-byte allocation
08-12 05:21:56.950 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26694K/28952K, paused 70ms, total 70ms
08-12 05:21:56.950 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R3]+1782ms
08-12 05:21:57.030 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26694K/28952K, paused 74ms, total 75ms
08-12 05:21:57.070 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.804MB for 2802292-byte allocation
08-12 05:21:57.140 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29430K/31692K, paused 73ms, total 73ms
08-12 05:21:57.380 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R3]+2205ms
08-12 05:21:57.430 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R3]+2253ms from custom transformations
08-12 05:21:57.430 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R3]+2258ms for completion
08-12 05:21:57.810 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R3]+2640ms from DISK
08-12 05:21:57.970 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R3]+2648ms
08-12 05:21:58.370 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 30 frames! The application may be doing too much work on its main thread.
08-12 05:22:00.430 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R4] Request{2130837601 1000x700 resize(837,837) centerInside}
08-12 05:22:00.460 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R4]+16ms
08-12 05:22:00.640 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R4]+212ms
08-12 05:22:02.190 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8760K, 10% free 22599K/24852K, paused 96ms, total 103ms
08-12 05:22:02.290 892-917/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.133MB for 4194320-byte allocation
08-12 05:22:04.520 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26694K/28952K, paused 78ms, total 90ms
08-12 05:22:04.520 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R4]+4097ms
08-12 05:22:04.660 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26694K/28952K, paused 99ms, total 101ms
08-12 05:22:04.920 892-917/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.805MB for 2802292-byte allocation
08-12 05:22:05.030 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29431K/31692K, paused 100ms, total 112ms
08-12 05:22:06.080 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R4]+5s
08-12 05:22:06.230 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R4]+5s from custom transformations
08-12 05:22:06.290 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R4]+5s for completion
08-12 05:22:06.440 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R4]+6s
08-12 05:22:06.450 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R4]+6s from DISK
08-12 05:22:07.010 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 30 frames! The application may be doing too much work on its main thread.
08-12 05:22:11.474 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R5] Request{2130837604 1000x700 resize(837,837) centerInside}
08-12 05:22:11.814 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R5]+257ms
08-12 05:22:11.824 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R5]+277ms
08-12 05:22:12.994 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8760K, 10% free 22599K/24852K, paused 74ms, total 74ms
08-12 05:22:13.044 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.133MB for 4194320-byte allocation
08-12 05:22:13.474 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26694K/28952K, paused 63ms, total 63ms
08-12 05:22:13.474 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R5]+2000ms
08-12 05:22:13.554 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26695K/28952K, paused 68ms, total 68ms
08-12 05:22:13.584 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.805MB for 2802292-byte allocation
08-12 05:22:13.664 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29431K/31692K, paused 73ms, total 74ms
08-12 05:22:13.894 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R5]+2422ms
08-12 05:22:13.944 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R5]+2471ms from custom transformations
08-12 05:22:13.954 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R5]+2474ms for completion
08-12 05:22:14.164 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R5]+2690ms from DISK
08-12 05:22:14.414 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R5]+2936ms
08-12 05:22:14.744 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 32 frames! The application may be doing too much work on its main thread.
08-12 05:22:15.814 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R6] Request{2130837606 1000x700 resize(837,837) centerInside}
08-12 05:22:15.824 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R6]+27ms
08-12 05:22:15.824 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R6]+31ms
08-12 05:22:16.524 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8760K, 10% free 22599K/24852K, paused 73ms, total 74ms
08-12 05:22:16.574 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.133MB for 4194320-byte allocation
08-12 05:22:17.014 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26695K/28952K, paused 62ms, total 63ms
08-12 05:22:17.014 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R6]+1220ms
08-12 05:22:17.084 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26695K/28952K, paused 67ms, total 68ms
08-12 05:22:17.124 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.805MB for 2802292-byte allocation
08-12 05:22:17.194 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 8% free 29431K/31692K, paused 75ms, total 75ms
08-12 05:22:17.444 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R6]+1646ms
08-12 05:22:17.504 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R6]+1706ms from custom transformations
08-12 05:22:17.514 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R6]+1710ms for completion
08-12 05:22:17.744 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R6]+1922ms
08-12 05:22:17.754 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R6]+1917ms from DISK
08-12 05:22:18.334 892-892/com.kidooz.kidooz_abcfun I/Choreographer﹕ Skipped 32 frames! The application may be doing too much work on its main thread.
08-12 05:22:19.574 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R7] Request{2130837607 1000x700 resize(837,837) centerInside}
08-12 05:22:19.584 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R7]+94ms
08-12 05:22:19.754 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R7]+100ms
08-12 05:22:20.224 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8760K, 10% free 22600K/24852K, paused 76ms, total 76ms
08-12 05:22:20.274 892-917/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.133MB for 4194320-byte allocation
08-12 05:22:20.344 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26695K/28952K, paused 70ms, total 70ms
08-12 05:22:21.004 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R7]+1507ms
08-12 05:22:21.074 892-917/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26695K/28952K, paused 69ms, total 70ms
08-12 05:22:21.104 892-917/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.805MB for 2802292-byte allocation
08-12 05:22:21.174 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29432K/31692K, paused 72ms, total 72ms
08-12 05:22:21.424 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R7]+1931ms
08-12 05:22:21.474 892-917/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R7]+1982ms from custom transformations
08-12 05:22:21.474 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R7]+1986ms for completion
08-12 05:22:21.684 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R7]+2195ms from DISK
08-12 05:22:21.714 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R7]+2202ms
08-12 05:22:24.014 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R8] Request{2130837609 1000x700 resize(837,837) centerInside}
08-12 05:22:24.024 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R8]+29ms
08-12 05:22:24.024 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R8]+35ms
08-12 05:22:24.694 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8759K, 10% free 22600K/24852K, paused 85ms, total 85ms
08-12 05:22:24.744 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.134MB for 4194320-byte allocation
08-12 05:22:25.244 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26695K/28952K, paused 64ms, total 65ms
08-12 05:22:25.244 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R8]+1252ms
08-12 05:22:25.314 892-968/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 8% free 26695K/28952K, paused 68ms, total 68ms
08-12 05:22:25.354 892-968/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.806MB for 2802292-byte allocation
08-12 05:22:25.434 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29432K/31692K, paused 75ms, total 75ms
08-12 05:22:25.684 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R8]+1689ms
08-12 05:22:25.734 892-968/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R8]+1736ms from custom transformations
08-12 05:22:25.734 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R8]+1741ms for completion
08-12 05:22:25.944 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R8]+1945ms
08-12 05:22:25.974 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R8]+1963ms from DISK
08-12 05:22:28.804 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main created [R9] Request{2130837611 1000x700 resize(837,837) centerInside}
08-12 05:22:28.954 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher enqueued [R9]+13ms
08-12 05:22:28.974 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter executing [R9]+154ms
08-12 05:22:29.414 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 8759K, 10% free 22600K/24852K, paused 74ms, total 75ms
08-12 05:22:29.464 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 26.134MB for 4194320-byte allocation
08-12 05:22:29.534 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 26696K/28952K, paused 76ms, total 76ms
08-12 05:22:29.904 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter decoded [R9]+1101ms
08-12 05:22:29.974 892-912/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed 2K, 8% free 26695K/28952K, paused 69ms, total 70ms
08-12 05:22:30.004 892-912/com.kidooz.kidooz_abcfun I/dalvikvm-heap﹕ Grow heap (frag case) to 28.806MB for 2802292-byte allocation
08-12 05:22:30.084 892-901/com.kidooz.kidooz_abcfun D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 8% free 29432K/31692K, paused 73ms, total 73ms
08-12 05:22:30.314 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R9]+1519ms
08-12 05:22:30.364 892-912/com.kidooz.kidooz_abcfun D/Picasso﹕ Hunter transformed [R9]+1567ms from custom transformations
08-12 05:22:30.364 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher batched [R9]+1571ms for completion
08-12 05:22:30.584 892-892/com.kidooz.kidooz_abcfun D/Picasso﹕ Main completed [R9]+1780ms from DISK
08-12 05:22:30.774 892-910/com.kidooz.kidooz_abcfun D/Picasso﹕ Dispatcher delivered [R9]+1773ms
答案 0 :(得分:2)
好的,我将逐行解释昂贵的行动:
.load(imageIds[currentIndex])
如上所述,这将从Internet或文件系统加载您的图像。在第一种情况下,下载时间取决于图像大小和Internet连接质量。在第二种情况下,它仅取决于图像大小,但请记住磁盘操作也是性能昂贵的。
.transform(new BitmapTransform(MAX_WIDTH, MAX_HEIGHT))
在这里,您要对新位图应用转换,该转换需要分配额外的内存来创建缩放位图。
.resize(size, size)
您要再次调整图片大小 - 我不熟悉Picasso的resize
实现,但我相信它还需要额外的内存。实际上你为什么两次调整图像大小?也许您应该考虑如何在一次转换中组合两个调整大小操作。
其他东西对性能没有严重影响。