Idea Review

Tuesday, October 2, 2007

Review the concept of our classmates' mobile application project

Revision of Nokia Snake: (Eric Chiu)

It's good to be retro sometimes, and especially to appreciate those classics. Nokia Snake is one of the cell phone games that you'll never forget. By revising Nokia Snake is not only good to practice J2ME sytax but also get a better idea of game design. Another point I wanna mention that is, to wisely manipulate color in the revision could be a plus factor that enhance the playing experience; And don't forget the sound !!!


Hello Stranger-Mobile Karaoke(Shin-Yi HUANG)

Since we can talk together, why not sing together? Karaoke is a good thing to be added in mobile application since it's another kind of communication which might involve more emotional information within. Moreover, we can't talk at exact same time because otherwise we cannot clearly hear what other people are saying. But singing is different, we can sing together at the same time to create wonderful harmony!

It would be a good trial if it's combined with lyrics on the screen, background music in your ear phone, and your friend's singing from somewhere far far away...!

EasyMap-Google Map Hack

How to make Google Map more useful on your phone if you don't have GPS function? Here are something I found hard to use Google Map on your phone:


1. Zoom In/Out
2.

Source Code:

import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.Canvas.*;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;



public class ImageMonkey extends MIDlet implements CommandListener, Runnable {

/*
* A reference to the MIDlet's Display object
*/
private Display mDisplay;

/*
* A form for displaying an image
*/
private Form mForm;
String url= "http://itp.nyu.edu/~htt213/Mobile/MapITP_01.png";

/*
* Constructor
*/
public ImageMonkey() {

mForm = new Form("Connecting...");
mForm.addCommand(new Command("Exit", Command.EXIT, 0));
mForm.setCommandListener(this);



}



public void startApp() {
if (mDisplay == null)
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(mForm);
// Run network operations in a separate thread.
Thread t = new Thread(this);
t.start();
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}

class KeyFinderCanvas extends Canvas {
int lastKeyCode = 0;
protected void keyPressed(int keyCode) {
lastKeyCode = keyCode;
System.out.println("Key Pressed");

}

protected void paint(Graphics g) {

if (lastKeyCode == 38){
url = "http://itp.nyu.edu/~htt213/Mobile/MapITP_01.png";
g.drawString("Zoom Out", getWidth()/2, getHeight()/2,
Graphics.BASELINE|Graphics.HCENTER);
System.out.println("Zoom Out!");


}

if (lastKeyCode == 40){
url = "http://itp.nyu.edu/~htt213/Mobile/MapITP_02.png";
g.drawString("Zoom in", getWidth()/2, getHeight()/2,
Graphics.BASELINE|Graphics.HCENTER);
System.out.println("Zoom In!");

}
}
}
public void run() {
HttpConnection hc = null;
DataInputStream in = null;





try {
/*
* We're going to read in a URL from the JAD file
* We could just as easily do something like this:
* String url = "http://website.com/mynewurl";
*/
//String url = getAppProperty("ImageMonkey-URL");
//String url = "http://itp.nyu.edu/~htt213/Mobile/MapITP_01.png";
System.out.println("Getting Map!");
hc = (HttpConnection) Connector.open(url);
int length = (int) hc.getLength();
byte[] data = null;
if (length != -1) {
System.out.println("Content Length is " + length);
data = new byte[length];
in = new DataInputStream(hc.openInputStream());
in.readFully(data);
}

else {
// If content length is not given, read in chunks.
int chunkSize = 512;
int index = 0;
int readLength = 0;
in = new DataInputStream(hc.openInputStream());
data = new byte[chunkSize];
do {
if (data.length < index + chunkSize) {
byte[] newData = new byte[index + chunkSize];
System.arraycopy(data, 0, newData, 0, data.length);
data = newData;
}
System.out.println(".");
readLength = in.read(data, index, chunkSize);
index += readLength;
} while (readLength == chunkSize);

length = index;
}

Image image = Image.createImage(data, 0, length);
ImageItem imageItem = new ImageItem(null, image, 0, null);
mForm.append(imageItem);
mForm.setTitle("Try using arrow key to zoom in");
}

catch (IOException ioe) {
StringItem stringItem = new StringItem(null, ioe.toString());
mForm.append(stringItem);
mForm.setTitle("Done.");
}

finally {
try {
if (in != null)
in.close();
if (hc != null)
hc.close();
} catch (IOException ioe) {
}
}
}
}