What to clean up in destroyApp?
What kind of things need to be cleaned up in destroyApp? I am quite new to java-me or java for that matter. Coming from C++ and Allegro. Some times, only after running the app I created, will stop sending or receiving calls/texts and every now and then will restart the phone when I close the app/game. Problem is solved by resetting phone. I assume it has something to do with the clean up procedure and my not doing it correctly.
variables:
Code:
public static class Character
{
private int x, y, frame, iframe;
}
public static Image block, blob, plants, trees, stumps;
public static Sprite Block, Blob, Plants, Trees, Stumps;
public int ScreenWidth = getWidth(), ScreenHeight = getHeight();
private static int MapOffsetX = 0, MapOffsetY = 0, BlockHeight = 32, BlockWidth = 32;
private static int MapMaxY, MapMaxX;
private static int SleepTime = 30, STEP = 4, PathAdd = 0;
private static boolean ScrollLeft = false, ScrollRight = false, ScrollUp = false, ScrollDown = false;
private static boolean MoveLeft = false, MoveRight = false, MoveUp = false, MoveDown = false, blobMove;
private static boolean MoveMap = true;
public static Character myBlob = new Character();
public static int myBlobFrameSeq[] = {0, 0, 1, 1, 2, 2};
public static Font font = null;
public static Random rand = new Random();
private static final int MAPNumber = 0, MAPObjects = 1, MAPCollide = 2, MAPGValue = 3;
private static final int MAPHValue = 4, MAPFValue = 5, MAPClosedList = 6, MAPParentList = 7;
private static int Lowest = MapMaxY * MapMaxX + MapMaxX + 1;
private static int NextToCheck = 0, FoundOpen = 0;
private static int iy, ix, x, y, i, ox, oy, Count, Distance;
private static int NoPath = 0;
private static int EndX = 0, EndY = 0, StartX = 0, StartY = 0, Sx = 0, Sy = 0;
private static int skipped = 0;
private static int isOpen = 0;
private static int[] toOpen = new int[2];
private static int o = 0;
public static class FindMAP
{
private int[][][] map = new int[8][100][100];
private int[] OpenList = new int[1000];
private int[] mapXY = new int[2], Final = new int[2], XYFinal = new int[2];
private int[][] BlockStruct = new int[100][3];
}
public static FindMAP tMap = new FindMAP();
my destroyApp:
Code:
public void destroyApp(boolean unconditional)
{
AwayCanvas.block = null;
AwayCanvas.blob = null;
AwayCanvas.plants = null;
AwayCanvas.trees = null;
AwayCanvas.stumps = null;
AwayCanvas.Block = null;
AwayCanvas.Blob = null;
AwayCanvas.Plants = null;
AwayCanvas.Trees = null;
AwayCanvas.Stumps = null;
AwayCanvas.myBlob = null;
AwayCanvas.myBlobFrameSeq = null;
AwayCanvas.rand = null;
AwayCanvas.tMap = null;
awayCanvas = null;
notifyDestroyed();
}