Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-04-03 Thread Michael Lamers
 
Hi,
 
I have the same problem using setImageURI. The problem seems to be worse 
than just a scaling issue.
It seems that some vendors have fixed this bug for some of their devices.
I have a HTC Sensation that doesn't scale the image set through 
setImageURI. All other devices I know do.
For me the only workaround for this is to measure the applied scaling by 
instantiating an ImageView that consumes a sample image from my 
ContentProvider. The extra scaling for the images that has to be applied 
can be calculated by comparing the ImageViews size to the original size of 
the sample image.
 
Fixing this bug wouldn't change anything for the next 2 years as most of us 
developers want to support not only the last generation of Android devices 
;)
 
Greetings
 
Michael

Am Freitag, 17. Februar 2012 21:56:40 UTC+1 schrieb Yuvi:

 Hi, 

 sorry to resurrect this post...but I got into a similar problem. And as 
 the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the 
 appwidget. However I noticed that my image is being scaled according to the 
 screen density.

 So, for example, on an XHDPI screen, if I have a bitmap which is 100x100 
 and I set it using setImageViewBitmap() I get the image to look as 100x100. 
 However, if I store that bitmap into a png on disk, and then use 
 setImageViewUri() my bitmap is displayed as 50x50.

 Do you know if there is a way to change this behavior? (i.e. if my image 
 is 100x100 I'd like it to remain 100x100 also after it is decoded).
 Maybe there is a way to force some density on the ImageView itself?

 My only workaround (which sucks..) is to scale-up the bitmap before 
 storing on disk so that when it is being decoded I get back my original 
 size. But in this way I use more memory to save the image and I also loose 
 image quality..:(

 I hope someone can help me!
 Thanks,
 Yuvi

 On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell  wrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create the 
 files using context.openFileOutput.  Unfortunately that means I loose the 
 ability to use directories.  I can't see a Java way to set permission on 
 files, it can be done with native methods, but that seems like overkill. 
  I'll do some more googling. 

 Thanks again for the help, I was worried that this problem might have 
 been a show-stopper.
 Ash
   
 -- 
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 -- 
 YuviDroid 
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget 
 to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net



-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-23 Thread YuviDroid
I think I found the problem...and it looks like it's an Android bug.
Drawable.createFromStream() doesn't take as parameter a Resources object,
and later it calls Drawable.createFromResourceStream() passing 'null' as
the Resources parameter.
From my understanding the resources are then used to ensure that the
drawable will set its target density correctly, but by being 'null' some
default density is used.


On Sat, Feb 18, 2012 at 2:40 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi Dianne,

 thanks for your reply. The problem is that I'm using
 RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
 density.
 The Uri I'm using is content://... which reaches my ContentProvider at
 the method openFile(Uri,String).

 I looked at the Android source code and I see that ImageView.setImageUri()
 uses resolveUri(), and for the content scheme it
 calls 
 Drawable.createFromStream(mContext.getContentResolver().openInputStream(mUri),
  null);
 which calls my openFile() method, which I implemented like this:
 public ParcelFileDescriptor openFile(Uri uri, String mode) throws
 FileNotFoundException {
 File file = new File(getContext().getFilesDir(), MyFile.png);

 return ParcelFileDescriptor.open(file,
 ParcelFileDescriptor.MODE_READ_ONLY);
 }

 I don't see where I can change the density to use. :(


 Thanks,
 Yuvi


 On Sat, Feb 18, 2012 at 2:19 AM, Dianne Hackborn hack...@android.comwrote:

 Set the desired density of your bitmap:
 http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)


 On Fri, Feb 17, 2012 at 12:56 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi,

 sorry to resurrect this post...but I got into a similar problem. And as
 the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
 appwidget. However I noticed that my image is being scaled according to the
 screen density.

 So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
 and I set it using setImageViewBitmap() I get the image to look as 100x100.
 However, if I store that bitmap into a png on disk, and then use
 setImageViewUri() my bitmap is displayed as 50x50.

 Do you know if there is a way to change this behavior? (i.e. if my image
 is 100x100 I'd like it to remain 100x100 also after it is decoded).
 Maybe there is a way to force some density on the ImageView itself?

 My only workaround (which sucks..) is to scale-up the bitmap before
 storing on disk so that when it is being decoded I get back my original
 size. But in this way I use more memory to save the image and I also loose
 image quality..:(

 I hope someone can help me!
 Thanks,
 Yuvi

 On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell 
 ash.mcconn...@gmail.comwrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create
 the files using context.openFileOutput.  Unfortunately that means I loose
 the ability to use directories.  I can't see a Java way to set permission
 on files, it can be done with native methods, but that seems like overkill.
  I'll do some more googling.

 Thanks again for the help, I was worried that this problem might have
 been a show-stopper.
 Ash

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a
 widget to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
 to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net




-- 
YuviDroid
Check out Launch-X 

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-19 Thread YuviDroid
I tried also to set the bitmap density before saving it to disk...just in
case it made any difference...but it doesn't.
No one has a solution to this issue?


Thanks,
Yuvi

On Sat, Feb 18, 2012 at 3:07 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi Mark,

 I actually switched from setImageViewBitmap() to setImageViewUri() because
 sometimes I need to display large bitmaps which do not work if I use
 setImageViewBitmap().


 Yuvi


 On Sat, Feb 18, 2012 at 2:57 PM, Mark Murphy mmur...@commonsware.comwrote:

 On Sat, Feb 18, 2012 at 8:40 AM, YuviDroid yuvidr...@gmail.com wrote:
  thanks for your reply. The problem is that I'm using
  RemoteViews.setImageViewUri(), so I don't have a bitmap object to set
 the
  density.

 Then switch to setBitmap() or setImageViewBitmap().

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android App Developer Books: http://commonsware.com/books

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
 to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread YuviDroid
Hi Dianne,

thanks for your reply. The problem is that I'm using
RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
density.
The Uri I'm using is content://... which reaches my ContentProvider at
the method openFile(Uri,String).

I looked at the Android source code and I see that ImageView.setImageUri()
uses resolveUri(), and for the content scheme it
calls 
Drawable.createFromStream(mContext.getContentResolver().openInputStream(mUri),
null);
which calls my openFile() method, which I implemented like this:
public ParcelFileDescriptor openFile(Uri uri, String mode) throws
FileNotFoundException {
File file = new File(getContext().getFilesDir(), MyFile.png);

return ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
}

I don't see where I can change the density to use. :(


Thanks,
Yuvi


On Sat, Feb 18, 2012 at 2:19 AM, Dianne Hackborn hack...@android.comwrote:

 Set the desired density of your bitmap:
 http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)


 On Fri, Feb 17, 2012 at 12:56 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi,

 sorry to resurrect this post...but I got into a similar problem. And as
 the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
 appwidget. However I noticed that my image is being scaled according to the
 screen density.

 So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
 and I set it using setImageViewBitmap() I get the image to look as 100x100.
 However, if I store that bitmap into a png on disk, and then use
 setImageViewUri() my bitmap is displayed as 50x50.

 Do you know if there is a way to change this behavior? (i.e. if my image
 is 100x100 I'd like it to remain 100x100 also after it is decoded).
 Maybe there is a way to force some density on the ImageView itself?

 My only workaround (which sucks..) is to scale-up the bitmap before
 storing on disk so that when it is being decoded I get back my original
 size. But in this way I use more memory to save the image and I also loose
 image quality..:(

 I hope someone can help me!
 Thanks,
 Yuvi

 On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell ash.mcconn...@gmail.comwrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create the
 files using context.openFileOutput.  Unfortunately that means I loose the
 ability to use directories.  I can't see a Java way to set permission on
 files, it can be done with native methods, but that seems like overkill.
  I'll do some more googling.

 Thanks again for the help, I was worried that this problem might have
 been a show-stopper.
 Ash

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a
 widget to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread Mark Murphy
On Sat, Feb 18, 2012 at 8:40 AM, YuviDroid yuvidr...@gmail.com wrote:
 thanks for your reply. The problem is that I'm using
 RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
 density.

Then switch to setBitmap() or setImageViewBitmap().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread YuviDroid
Hi Mark,

I actually switched from setImageViewBitmap() to setImageViewUri() because
sometimes I need to display large bitmaps which do not work if I use
setImageViewBitmap().


Yuvi

On Sat, Feb 18, 2012 at 2:57 PM, Mark Murphy mmur...@commonsware.comwrote:

 On Sat, Feb 18, 2012 at 8:40 AM, YuviDroid yuvidr...@gmail.com wrote:
  thanks for your reply. The problem is that I'm using
  RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
  density.

 Then switch to setBitmap() or setImageViewBitmap().

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android App Developer Books: http://commonsware.com/books

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-17 Thread YuviDroid
Hi,

sorry to resurrect this post...but I got into a similar problem. And as the
OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
appwidget. However I noticed that my image is being scaled according to the
screen density.

So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
and I set it using setImageViewBitmap() I get the image to look as 100x100.
However, if I store that bitmap into a png on disk, and then use
setImageViewUri() my bitmap is displayed as 50x50.

Do you know if there is a way to change this behavior? (i.e. if my image is
100x100 I'd like it to remain 100x100 also after it is decoded).
Maybe there is a way to force some density on the ImageView itself?

My only workaround (which sucks..) is to scale-up the bitmap before storing
on disk so that when it is being decoded I get back my original size. But
in this way I use more memory to save the image and I also loose image
quality..:(

I hope someone can help me!
Thanks,
Yuvi

On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell ash.mcconn...@gmail.comwrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create the
 files using context.openFileOutput.  Unfortunately that means I loose the
 ability to use directories.  I can't see a Java way to set permission on
 files, it can be done with native methods, but that seems like overkill.
  I'll do some more googling.

 Thanks again for the help, I was worried that this problem might have been
 a show-stopper.
 Ash

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-17 Thread Dianne Hackborn
Set the desired density of your bitmap:
http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)

On Fri, Feb 17, 2012 at 12:56 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi,

 sorry to resurrect this post...but I got into a similar problem. And as
 the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
 appwidget. However I noticed that my image is being scaled according to the
 screen density.

 So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
 and I set it using setImageViewBitmap() I get the image to look as 100x100.
 However, if I store that bitmap into a png on disk, and then use
 setImageViewUri() my bitmap is displayed as 50x50.

 Do you know if there is a way to change this behavior? (i.e. if my image
 is 100x100 I'd like it to remain 100x100 also after it is decoded).
 Maybe there is a way to force some density on the ImageView itself?

 My only workaround (which sucks..) is to scale-up the bitmap before
 storing on disk so that when it is being decoded I get back my original
 size. But in this way I use more memory to save the image and I also loose
 image quality..:(

 I hope someone can help me!
 Thanks,
 Yuvi

 On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell ash.mcconn...@gmail.comwrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create the
 files using context.openFileOutput.  Unfortunately that means I loose the
 ability to use directories.  I can't see a Java way to set permission on
 files, it can be done with native methods, but that seems like overkill.
  I'll do some more googling.

 Thanks again for the help, I was worried that this problem might have
 been a show-stopper.
 Ash

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
 to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-09-19 Thread Efi Merdler-Kravitz
Hi,

I'm encountering exactly the same problem,however I'm not getting my failed 
bind transaction immediately, it looks like it happens after a certain 
amount of widget updates.
The initial size is small enough to succeed and the image size is small ( 
I'm always updating a small single image ~ 4K).

In order to to conserve resources I'm not inflating my widget on each update 
instead I'm using the same RemoteViews only updating the image, for example:

// Use cached value.
RemoteViews returnValue = mRemoteViewCreator.getRemoteView();
returnValue.setImageViewBitmap(R.id.imgTextWithImage, myImg);
...
appWidgetManager.updateAppWidget(thisWidget, returnValue);

Couple of questions:
1. Does it make sense to update the widget this way ? Is it really faster ?
2. How do I know what is size that is transferred through the IPC mechanism 
?

Thank you.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-02 Thread Ash McConnell
Odd that File.setReadable doesn't seem to be available on my JDK 
installation (the latest version of 1.6)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-02 Thread Ash McConnell
It's because Android implemented Java.io.File and didn't include 
File.setReadable until API 9 (I am using API 8)

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Kostya Vasilyev
If you are overflowing the binder RPC mechanism, maybe your bitmap 
really is too large, and would cause performance problems even if it 
went through.


There are other ways to push a dynamically generated bitmap into a 
widget, perhaps you should consider those.


-- Kostya

01.08.2011 18:45, Ash McConnell пишет:

Hi Folks,

I am coming across an error when I am updating my RemoteViews in my
AppWidget.

!!! FAILED BINDER TRANSACTION !!!

This is caused because all the changes to the RemoteViews are
serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also
serialised into an internal bundle. Unfortunately this bundle has a
very small size limit.

I cannot use setImageResource as I am hoping to allow the user to
download skins for the widget.

Can anyone recommend a workaround for this problem? I am already using
a new RemoteViews object for each instance of the widget, but a
single instance contains too many updates.

All the best,
Ash



--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Ash McConnell
Hi Kostya,

It's not that the single bitmap is too large, it's that I'm updating quite a 
few bitmaps.  The biggest bitmap in PNG form (a lot smaller I know) is only 
4KB. I am updating 14 ImageViews in each update.  Is there any way to split 
the update for each widget instance somehow?

What are the other methods to push a bitmap into a widget?  Anything I could 
search for?

Thanks for your help!
All the best,
Ash

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Kostya Vasilyev


01.08.2011 19:02, Ash McConnell пишет:

Hi Kostya,

It's not that the single bitmap is too large, it's that I'm updating 
quite a few bitmaps. The biggest bitmap in PNG form (a lot smaller I 
know) is only 4KB. I am updating 14 ImageViews in each update. Is 
there any way to split the update for each widget instance somehow?


Binder data size limit is 512K, IIRC, so it should be enough for the update.

Are you sure the failed transaction is not caused by bad data in 
RemoteViews (references to views that don't exist, etc.) that cause the 
remote side (Launcher) to crash?




What are the other methods to push a bitmap into a widget? Anything I 
could search for?


ImageView can grab images from a Uri, and supports content:// and 
file:// style Uris.


-- Kostya



Thanks for your help!
All the best,
Ash


--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Dianne Hackborn
It is actually 1MB.  The most common reason for this error is a too large
IPC.  As a quick test, you could try removing half the bitmaps or so and see
if it works.  If so, the issue is almost certainly an IPC that is too large.
 If that is the case, you just need to reduce the amount of data being sent
over.

On Mon, Aug 1, 2011 at 8:18 AM, Kostya Vasilyev kmans...@gmail.com wrote:


 01.08.2011 19:02, Ash McConnell пишет:

  Hi Kostya,

 It's not that the single bitmap is too large, it's that I'm updating quite
 a few bitmaps. The biggest bitmap in PNG form (a lot smaller I know) is only
 4KB. I am updating 14 ImageViews in each update. Is there any way to split
 the update for each widget instance somehow?


 Binder data size limit is 512K, IIRC, so it should be enough for the
 update.

 Are you sure the failed transaction is not caused by bad data in
 RemoteViews (references to views that don't exist, etc.) that cause the
 remote side (Launcher) to crash?



 What are the other methods to push a bitmap into a widget? Anything I
 could search for?


 ImageView can grab images from a Uri, and supports content:// and file://
 style Uris.

 -- Kostya



 Thanks for your help!
 All the best,
 Ash


 --
 Kostya Vasilyev


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to 
 android-developers@**googlegroups.comandroid-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Ash McConnell
Hi Kostya / Dianne,

Thanks for the replies.  As Dianne suggested, removing half the bitmaps does 
indeed make it work.

I can't really reduce the amount of bitmaps, so I am trying to use the 
setImageURI on ImageView.  Unfortunately I am getting permission denied 
errors.

Here is the test code I used: -

File file = new File(context.getFilesDir().getAbsolutePath() 
+ /skins/Minimal/flight_on.png);
if (file.exists()){
Uri uri = Uri.fromFile(file);
Log.i(LOGTAG, uri.toString());
views.setUri(R.id.buttonSound, setImageURI, uri);
}


The file *does* exist and I get the following log message: -

08-01 17:19:20.304: INFO/WidgetTest(4563): 
file:///data/data/sirocco.widgets/files/skins/Minimal/flight_on.png

I didn't think I would have permission problems with the widget's own files. 
 Is there a problem with accessing these files from a widget (actually a 
private service class within the widget)?

Thanks again for your help
All the best,
Ash

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Dianne Hackborn
Those files aren't be accessed by you, they are being opened by another app
(the launcher) when it applies your RemoteViews to the widget it is
displaying.

On Mon, Aug 1, 2011 at 9:23 AM, Ash McConnell ash.mcconn...@gmail.comwrote:

 Hi Kostya / Dianne,

 Thanks for the replies.  As Dianne suggested, removing half the bitmaps
 does indeed make it work.

 I can't really reduce the amount of bitmaps, so I am trying to use the
 setImageURI on ImageView.  Unfortunately I am getting permission denied
 errors.

 Here is the test code I used: -

 File file = new
 File(context.getFilesDir().getAbsolutePath() +
 /skins/Minimal/flight_on.png);
 if (file.exists()){
  Uri uri = Uri.fromFile(file);
 Log.i(LOGTAG, uri.toString());
 views.setUri(R.id.buttonSound, setImageURI, uri);
  }


 The file *does* exist and I get the following log message: -

 08-01 17:19:20.304: INFO/WidgetTest(4563):
 file:///data/data/sirocco.widgets/files/skins/Minimal/flight_on.png

 I didn't think I would have permission problems with the widget's own
 files.  Is there a problem with accessing these files from a widget
 (actually a private service class within the widget)?

 Thanks again for your help
 All the best,
 Ash

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Ash McConnell
Ah ok, I copy the files over into the skins directory in my configuration 
activity.  I currently use normal java.io.FileOutputStream objects, should I 
be using context.openFileOutput with 
MODE_WORLD_READABLEhttp://developer.android.com/reference/android/content/Context.html#MODE_WORLD_READABLE
 set?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Kostya Vasilyev

That should work.

01.08.2011 20:40, Ash McConnell ?:
Ah ok, I copy the files over into the skins directory in my 
configuration activity.  I currently use normal 
java.io.FileOutputStream objects, should I be 
using context.openFileOutput with MODE_WORLD_READABLE 
http://developer.android.com/reference/android/content/Context.html#MODE_WORLD_READABLE set? 



--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Ash McConnell
Thanks Kostya and Dianne, setUri works as expected.  I had to create the 
files using context.openFileOutput.  Unfortunately that means I loose the 
ability to use directories.  I can't see a Java way to set permission on 
files, it can be done with native methods, but that seems like overkill. 
 I'll do some more googling.

Thanks again for the help, I was worried that this problem might have been a 
show-stopper.
Ash

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2011-08-01 Thread Kostya Vasilyev
Well, there is File.setReadable, which is supposed to be able to change 
the permissions, but I've never tried it myself


01.08.2011 22:05, Ash McConnell пишет:
Thanks Kostya and Dianne, setUri works as expected. I had to create 
the files using context.openFileOutput. Unfortunately that means I 
loose the ability to use directories. I can't see a Java way to set 
permission on files, it can be done with native methods, but that 
seems like overkill. I'll do some more googling.


Thanks again for the help, I was worried that this problem might have 
been a show-stopper.

Ash



--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en