1
我有一個問題,當我嘗試更新我的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限制。爲什麼如此以及如何避免這種情況?
但製作較小的位圖只會延遲錯誤,它不會避免這種情況:/ –