Hi everyone.
Basically, I have a grid of ImageButtons, and if the user touches the
right one, every image changes
It worked fine on 2.x, but now I have a problem with 3.1, galaxy tabs
10.1 precisely.
everytime I call setImageResource, (or setImageBitmap using
BitmapFactory), the changing is awfully slow, and it provokes the
logCat to display
"GC_FOR_ALLOC freed xK..."
I tried to look into the heap, to use MAT, but I am not used to these
tools and wasn't sure of what I was doing.
here is the code I use to change every button's image
for (int i = 0; i < n_lines; i++)
{
//for each line of the grid
for (int j = 0; j < n_columns&& (i * n_columns) + j < objets.size(); j
++)
{
//and each column of the grid
//we get the button, which Id has been changed to its index in
the
grid
ImageButton ib = (ImageButton) findViewById( ( (i * n_columns) +
j) );
//This line provokes a GC_FOR_ALLOC that takes around 23ms,
only on
a galaxy tab 10.1 (Android 3.1)
ib.setImageResource(<ResID of the drawable>);
}
}
The grid can be up to 6x6 (36), but even with a size of 2x2 (4),
GC_FOR_ALLOC is called every time
This piece of code takes about 40ms on a 2.x device (a HTC desire(2.3)
and a galaxy tab 7(2.2) )
It takes over a second on a 3.1 device (four Galaxy tab 10.1)
Am I doing something wrong? Are Resources or Drawables managed
differently on Honeycomb?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en