So in hindsight I'm not sure you can actually help. I will have to try and hunt it down somehow I think. Any ideas where to look?
I have 5 activities ('screens') with a canvas.
2 do not have any background image. 1 uses .DrawCircle to draw different coloured circles of increasing size, as described above.
1 has a background image which is set in $define:
canvasGameOver = new Canvas(this, R.id.canvasGameOver);
canvasGameOver.BackgroundImage("planet_gameover");
1 has a background image which is set in a procedure
private void setCanvasOn() {
canvasScreen1.BackgroundImage("canvasscreen1bg.png");
}
and then removed in another procedure
private void setCanvasOff() {
canvasScreen1.BackgroundImage("");
}
1 has a background image set in ScreenInitialize:
canvasSectorMap.BackgroundImage("bgmap"+MapSector+".png");
and then it is removed in onDestroy
public void onDestroy() {
super.onDestroy();
canvasSectorMap.BackgroundImage("");
}
After this, and on each activity, in onDestroy I am calling this unbindDrawables procedure, this was to get rid of the OutOfMemoryErrors:
public void unbindDrawables(View view) {
try{
if (view.getBackground() != null) {
((BitmapDrawable)view.getBackground()).getBitmap().recycle();
view.getBackground().setCallback(null);
view=null;
}
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
Could setting the canvas backgroundImage to ("") and then calling this procedure afterwards be the problem?
--
You received this message because you are subscribed to the Google Groups "Java Bridge Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alternate-java-bridge-libr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
==Hal
To unsubscribe from this group and stop receiving emails from it, send an email to alternate-java-bridge-library-discussion+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to alternate-java-bridge-libr...@googlegroups.com.