Reputation: 429
trying to get my first android widget and let me tell you moving from Visual Studio Pro to eclipse is not a smooth thing! Anyway i run into the above error which gives me some trouble to solve. Ive searched for all possible duplicates and it seems that this error occurs when the app hits IPC size (ie. big images)
My small widget launches an intentservice to download some info from the web and one image. the original image size of the png is around 100k. However before i update widget I downscale to around 17k. (checked with memory tracker size was 16400bytes[]). and yet the update fails. if i remove the image the update is successful.
this is the listener in widgetprovider which get executed:
public void onHttpLoaded(Bitmap image, String titlestring, String subtitlestring)
{
Context context = getApplicationContext();
if (image == null) //no data?
{
Toast.makeText(context, context.getResources().getString(R.string.null_data_toast), Toast.LENGTH_LONG);
return;// exit!
}
try
{
RemoteViews widgetView = new RemoteViews(this.getPackageName(), R.layout.main);
widgetView.setTextViewText(R.id.title, titlestring);
//all other comment out
//The problem!
widgetView.setImageViewBitmap(R.id.main_icon, image);
//Get global appwidgetmanager
AppWidgetManager manager = AppWidgetManager.getInstance(this);
//update widget
manager.updateAppWidget(Constants.THIS_APPWIDGET, widgetView);
}
catch (Exception e)
{
Log.d("onHttpLoaded", e.toString());
}
}
and the onHandleIntent from my service that the above code gets called:
protected void onHandleIntent(Intent intent)
{
resources = getApplicationContext().getResources();
int iAppWidgetId;
try
{
iAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
catch (Exception e)
{
Log.d("Service", "WidgetID not found");
}
//comment out stuff...
//launch new httpTask
httpTask myhttpTask = new httpTask(tittlestring, subtitlestring, (myHttpListener) MyUpdateService.this, MyUpdateService.this);
//limit size of bitmap
myhttpTask.setSampleSize(Constants.BITMAP_SAMPLE_SIZE); //size = 4
myhttpTask.execute();
}
all tests are done in emulator. one detail that may be important is that in logcat i get 20-30 fail messages "!!! failed binder transaction !!!" any ideas on how i messed this up? thnks!
Upvotes: 0
Views: 3820