Android dip vis pixels. Having terrible trouble with my 2d tilemap?
I've searched/read all of the dip to pixel translations, but I'm feeling a little overwhelmed by it all, I'm sure it's incredibly easy to grasp, but I'm quite old school :( So I'm pleading for some help on the matter, if anyone's got the time.

I've got an android game using a SurfaceView, which draws a 2d tilemap to the screen for a puzzle game. I've stupidly hardcoded all values for my device, just to get it up and running. Now it's pretty much 100% complete, I went out and bought a Samsung Galaxy tab, and it looks like poop! Can anyone shed some light on how to get the following code to work in dip/dp, rather than pixels please?

TIA!

        public static int MAX_WIDTH 		        = 320; // width of map area
        public static int MAX_HEIGHT 		        = 480; // height of map area
        public static final int TILE_SIZE_2		= 32; // tile size dimensions

I then set my map area to a pre-defined area

        map_area = new int[MAX_WIDTH/TILE_SIZE][MAX_HEIGHT/TILE_SIZE];

Here is how I setup the levels themselves (you'll see what I mean when I'm old school) - It's a shambles, I know! I do have time to waste though!

        	public void mapStringToMap(String mapString){
		// clear the map first
		int i= 0;
		rocks = new CTile[mapString.length()];

        try
        {
		// now add the rock types to the map array
		for(int x = 0; x<MAX_WIDTH/TILE_SIZE; x++){
			for(int y =0; y<MAX_HEIGHT/TILE_SIZE; y++){
                rocks[i] = new CTile();
				setMapData(x, y, Integer.parseInt(String.valueOf(mapString.charAt(i))));
				rocks[i].setRockType(Integer.parseInt(String.valueOf(mapString.charAt(i))));
				rocks[i].setX(x*TILE_SIZE);
				rocks[i].setY(y*TILE_SIZE);
				rocks[i].setRockId(i);
				
				if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == GOLD_TILE){
					rocks[i].setRockBitmap(goldTile);
                    // increase the number of rocks for this level
                    level_rock_count+=3;
				}else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == SILVER_TILE){
					rocks[i].setRockBitmap(silverTile);
                    // increase the number of rocks for this level
                    level_rock_count+=2;
				}else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == COPPER_TILE){
					rocks[i].setRockBitmap(copperTile);
                    // increase the number of rocks for this level
                    level_rock_count++;
                }else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == START_TILE){
                    dave.setX(x*TILE_SIZE);
                    dave.setY(y*TILE_SIZE);
                }else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == DIAMOND_TILE_1){
                	rocks[i].setRockBitmap(diamondTile1);
                	// increase the number of rocks for this level by 4!
                	level_rock_count += 4;
                }

                // move on 
				i++;
			}
		}
        }
        catch(ArrayIndexOutOfBoundsException e)
        {
            e.printStackTrace();
        }
	}

As a result, it works wonderfully on my device, but I'm trying to cover as many handsets as I can, obviously. The drawing of the maps is pretty much identical to above, the whole grid values x/y * TILE_SIZE etc. 

I'm sure I'm going to kick myself, but I just can't wrap my head around anything I've read.

Cheers.
Android dip vis pixels. Having terrible trouble with my 2d tilemap?
===

I've searched/read all of the dip to pixel translations, but I'm feeling a little overwhelmed by it all, I'm sure it's incredibly easy to grasp, but I'm quite old school :( So I'm pleading for some help on the matter, if anyone's got the time.

I've got an android game using a SurfaceView, which draws a 2d tilemap to the screen for a puzzle game. I've stupidly hardcoded all values for my device, just to get it up and running. Now it's pretty much 100% complete, I went out and bought a Samsung Galaxy tab, and it looks like poop! Can anyone shed some light on how to get the following code to work in dip/dp, rather than pixels please?

TIA!

        public static int MAX_WIDTH 		        = 320; // width of map area
        public static int MAX_HEIGHT 		        = 480; // height of map area
        public static final int TILE_SIZE_2		= 32; // tile size dimensions

I then set my map area to a pre-defined area

        map_area = new int[MAX_WIDTH/TILE_SIZE][MAX_HEIGHT/TILE_SIZE];

Here is how I setup the levels themselves (you'll see what I mean when I'm old school) - It's a shambles, I know! I do have time to waste though!

        	public void mapStringToMap(String mapString){
		// clear the map first
		int i= 0;
		rocks = new CTile[mapString.length()];

        try
        {
		// now add the rock types to the map array
		for(int x = 0; x<MAX_WIDTH/TILE_SIZE; x++){
			for(int y =0; y<MAX_HEIGHT/TILE_SIZE; y++){
                rocks[i] = new CTile();
				setMapData(x, y, Integer.parseInt(String.valueOf(mapString.charAt(i))));
				rocks[i].setRockType(Integer.parseInt(String.valueOf(mapString.charAt(i))));
				rocks[i].setX(x*TILE_SIZE);
				rocks[i].setY(y*TILE_SIZE);
				rocks[i].setRockId(i);
				
				if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == GOLD_TILE){
					rocks[i].setRockBitmap(goldTile);
                    // increase the number of rocks for this level
                    level_rock_count+=3;
				}else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == SILVER_TILE){
					rocks[i].setRockBitmap(silverTile);
                    // increase the number of rocks for this level
                    level_rock_count+=2;
				}else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == COPPER_TILE){
					rocks[i].setRockBitmap(copperTile);
                    // increase the number of rocks for this level
                    level_rock_count++;
                }else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == START_TILE){
                    dave.setX(x*TILE_SIZE);
                    dave.setY(y*TILE_SIZE);
                }else if(Integer.parseInt(String.valueOf(mapString.charAt(i))) == DIAMOND_TILE_1){
                	rocks[i].setRockBitmap(diamondTile1);
                	// increase the number of rocks for this level by 4!
                	level_rock_count += 4;
                }

                // move on 
				i++;
			}
		}
        }
        catch(ArrayIndexOutOfBoundsException e)
        {
            e.printStackTrace();
        }
	}

As a result, it works wonderfully on my device, but I'm trying to cover as many handsets as I can, obviously. The drawing of the maps is pretty much identical to above, the whole grid values x/y * TILE_SIZE etc. 

I'm sure I'm going to kick myself, but I just can't wrap my head around anything I've read.

Cheers.