2011-12-10 87 views
1

可能重複:
failed binder transaction on widget update失敗粘結劑交易

我有一個問題,當我嘗試更新我的Android窗口小部件的位圖。 JAVA失敗的BINDER TRANSACTION錯誤開始在我的logcat中循環10到12位更新後,我的小部件在此之後停止更新。我現在所做的只是在當前的小部件中顯示當前的秒數。 這就是我如何創建一個位圖

public static Bitmap buildUpdate(String time,Context ctx) 
    { 
Bitmap myBitmap=null; 
    myBitmap = Bitmap.createBitmap(160, 84, Bitmap.Config.ARGB_4444); 
    Canvas myCanvas = new Canvas(myBitmap); 
    Paint paint = new Paint(); 
    Typeface clock = Typeface.createFromAsset(ctx.getAssets(),"AladinRegular.ttf"); 
    paint.setAntiAlias(true); 
    paint.setSubpixelText(true); 
    paint.setTypeface(clock); 
    paint.setStyle(Paint.Style.FILL); 
    paint.setColor(Color.WHITE); 
    paint.setTextSize(65); 
    paint.setTextAlign(Align.CENTER); 
    myCanvas.drawText(time, 80, 60, paint); 
    return myBitmap; 
    } 

而這正是我打電話來更新我的ImageView

remoteViews.setImageViewBitmap(R.id.label_fg, Drawing.buildUpdate(seconds+" ",ctxt)); 

我不知道我似乎在這裏做錯了,我的一切經過兩天的研究,我正在打IPC限制。爲什麼如此以及如何避免這種情況?

回答

2

是的,你達到了通過活頁夾調用傳遞的位圖的大小限制。更新版本的Android使用更新的機制,並且限制更高。

您可以通過使用較小的位圖避免錯誤。 :)

+1

但製作較小的位圖只會延遲錯誤,它不會避免這種情況:/ –