I have a PAC MAN game code how to name this game in android as activity .. and I want to call an online game in an Android application, than how to call online games in an Android application using the link if the user clicks on this specific link on a game than online games on the net such as PAC MAN. thanks
public class Board extends JPanel implements ActionListener { Dimension d; Font smallfont = new Font("Helvetica", Font.BOLD, 14); FontMetrics fmsmall, fmlarge; Image ii; Color dotcolor = new Color(192, 192, 0); Color mazecolor; boolean ingame = false; boolean dying = false; final int blocksize = 24; final int nrofblocks = 15; final int scrsize = nrofblocks * blocksize; final int pacanimdelay = 2; final int pacmananimcount = 4; final int maxghosts = 12; final int pacmanspeed = 6; int pacanimcount = pacanimdelay; int pacanimdir = 1; int pacmananimpos = 0; int nrofghosts = 6; int pacsleft, score; int deathcounter; int[] dx, dy; int[] ghostx, ghosty, ghostdx, ghostdy, ghostspeed; Image ghost; Image pacman1, pacman2up, pacman2left, pacman2right, pacman2down; Image pacman3up, pacman3down, pacman3left, pacman3right; Image pacman4up, pacman4down, pacman4left, pacman4right; int pacmanx, pacmany, pacmandx, pacmandy; int reqdx, reqdy, viewdx, viewdy; final short leveldata[] = { 19, 26, 26, 26, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 22, 21, 0, 0, 0, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 21, 0, 0, 0, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 21, 0, 0, 0, 17, 16, 16, 24, 16, 16, 16, 16, 16, 16, 20, 17, 18, 18, 18, 16, 16, 20, 0, 17, 16, 16, 16, 16, 16, 20, 17, 16, 16, 16, 16, 16, 20, 0, 17, 16, 16, 16, 16, 24, 20, 25, 16, 16, 16, 24, 24, 28, 0, 25, 24, 24, 16, 20, 0, 21, 1, 17, 16, 20, 0, 0, 0, 0, 0, 0, 0, 17, 20, 0, 21, 1, 17, 16, 16, 18, 18, 22, 0, 19, 18, 18, 16, 20, 0, 21, 1, 17, 16, 16, 16, 16, 20, 0, 17, 16, 16, 16, 20, 0, 21, 1, 17, 16, 16, 16, 16, 20, 0, 17, 16, 16, 16, 20, 0, 21, 1, 17, 16, 16, 16, 16, 16, 18, 16, 16, 16, 16, 20, 0, 21, 1, 17, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 20, 0, 21, 1, 25, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 18, 20, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 25, 24, 24, 24, 28 }; final int validspeeds[] = { 1, 2, 3, 4, 6, 8 }; final int maxspeed = 6; int currentspeed = 3; short[] screendata; Timer timer; public Board() { GetImages(); addKeyListener(new TAdapter()); screendata = new short[nrofblocks * nrofblocks]; mazecolor = new Color(5, 100, 5); setFocusable(true); d = new Dimension(400, 400); setBackground(Color.black); setDoubleBuffered(true); ghostx = new int[maxghosts]; ghostdx = new int[maxghosts]; ghosty = new int[maxghosts]; ghostdy = new int[maxghosts]; ghostspeed = new int[maxghosts]; dx = new int[4]; dy = new int[4]; timer = new Timer(40, this); timer.start(); } public void addNotify() { super.addNotify(); GameInit(); } public void DoAnim() { pacanimcount--; if (pacanimcount <= 0) { pacanimcount = pacanimdelay; pacmananimpos = pacmananimpos + pacanimdir; if (pacmananimpos == (pacmananimcount - 1) || pacmananimpos == 0) pacanimdir = -pacanimdir; } } public void PlayGame(Graphics2D g2d) { if (dying) { Death(); } else { MovePacMan(); DrawPacMan(g2d); moveGhosts(g2d); CheckMaze(); } } public void ShowIntroScreen(Graphics2D g2d) { g2d.setColor(new Color(0, 32, 48)); g2d.fillRect(50, scrsize / 2 - 30, scrsize - 100, 50); g2d.setColor(Color.white); g2d.drawRect(50, scrsize / 2 - 30, scrsize - 100, 50); String s = "Press s to start."; Font small = new Font("Helvetica", Font.BOLD, 14); FontMetrics metr = this.getFontMetrics(small); g2d.setColor(Color.white); g2d.setFont(small); g2d.drawString(s, (scrsize - metr.stringWidth(s)) / 2, scrsize / 2); } public void DrawScore(Graphics2D g) { int i; String s; g.setFont(smallfont); g.setColor(new Color(96, 128, 255)); s = "Score: " + score; g.drawString(s, scrsize / 2 + 96, scrsize + 16); for (i = 0; i < pacsleft; i++) { g.drawImage(pacman3left, i * 28 + 8, scrsize + 1, this); } } public void CheckMaze() { short i = 0; boolean finished = true; while (i < nrofblocks * nrofblocks && finished) { if ((screendata[i] & 48) != 0) finished = false; i++; } if (finished) { score += 50; if (nrofghosts < maxghosts) nrofghosts++; if (currentspeed < maxspeed) currentspeed++; LevelInit(); } } public void Death() { pacsleft--; if (pacsleft == 0) ingame = false; LevelContinue(); } public void moveGhosts(Graphics2D g2d) { short i; int pos; int count; for (i = 0; i < nrofghosts; i++) { if (ghostx[i] % blocksize == 0 && ghosty[i] % blocksize == 0) { pos = ghostx[i] / blocksize + nrofblocks * (int)(ghosty[i] / blocksize); count = 0; if ((screendata[pos] & 1) == 0 && ghostdx[i] != 1) { dx[count] = -1; dy[count] = 0; count++; } if ((screendata[pos] & 2) == 0 && ghostdy[i] != 1) { dx[count] = 0; dy[count] = -1; count++; } if ((screendata[pos] & 4) == 0 && ghostdx[i] != -1) { dx[count] = 1; dy[count] = 0; count++; } if ((screendata[pos] & 8) == 0 && ghostdy[i] != -1) { dx[count] = 0; dy[count] = 1; count++; } if (count == 0) { if ((screendata[pos] & 15) == 15) { ghostdx[i] = 0; ghostdy[i] = 0; } else { ghostdx[i] = -ghostdx[i]; ghostdy[i] = -ghostdy[i]; } } else { count = (int)(Math.random() * count); if (count > 3) count = 3; ghostdx[i] = dx[count]; ghostdy[i] = dy[count]; } } ghostx[i] = ghostx[i] + (ghostdx[i] * ghostspeed[i]); ghosty[i] = ghosty[i] + (ghostdy[i] * ghostspeed[i]); DrawGhost(g2d, ghostx[i] + 1, ghosty[i] + 1); if (pacmanx > (ghostx[i] - 12) && pacmanx < (ghostx[i] + 12) && pacmany > (ghosty[i] - 12) && pacmany < (ghosty[i] + 12) && ingame) { dying = true; deathcounter = 64; } } } public void DrawGhost(Graphics2D g2d, int x, int y) { g2d.drawImage(ghost, x, y, this); } public void MovePacMan() { int pos; short ch; if (reqdx == -pacmandx && reqdy == -pacmandy) { pacmandx = reqdx; pacmandy = reqdy; viewdx = pacmandx; viewdy = pacmandy; } if (pacmanx % blocksize == 0 && pacmany % blocksize == 0) { pos = pacmanx / blocksize + nrofblocks * (int)(pacmany / blocksize); ch = screendata[pos]; if ((ch & 16) != 0) { screendata[pos] = (short)(ch & 15); score++; } if (reqdx != 0 || reqdy != 0) { if (!((reqdx == -1 && reqdy == 0 && (ch & 1) != 0) || (reqdx == 1 && reqdy == 0 && (ch & 4) != 0) || (reqdx == 0 && reqdy == -1 && (ch & 2) != 0) || (reqdx == 0 && reqdy == 1 && (ch & 8) != 0))) { pacmandx = reqdx; pacmandy = reqdy; viewdx = pacmandx; viewdy = pacmandy; } }