article

Creating a Cellphone Game/Application

Email
Submitted on: 1/3/2015 3:06:00 AM
By: R. Kistner (from psc cd)  
Level: Beginner
User Rating: By 13 Users
Compatibility: Java (JDK 1.2)
Views: 1605
 
     Learn how to create a game or application for your cellphone.


 
				

Creating Cellphone Game or Application

by Ralf Kistner

To create a game or application for your cellphone, you need the following:

  • Jdk1.3 or higher (http://java.sun.com/j2se/1.4.1/download.html)
  • J2ME Wireless Toolkit (http://java.sun.com/products/j2mewtoolkit/download-2_0.html)
  • Any Java IDE or text editor
  • A java-compatible cellphone (optional)

Note: This is not a tutorial to teach you Java. You should be confident with Java before reading this tutorial.

Getting started with J2ME

Step 1: In J2ME Wireless Toolkit, create a new project. Give the project any name you want. Make the class name Main. You don't need to change any of the settings.

Step 2: Create [J2ME home dir]\apps\[project name]\src\Main.java with the following code:


import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
public class Main extends MIDlet {
	private Form mainForm;
	
	public Main() {
		//create a new Form with the specified title
		mainForm = new Form("Hello World");
		//append a String to the form
		mainForm.append("Hello World!");
	}
	
	public void startApp () {
		//show the Form in the display area
		Display.getDisplay(this).setCurrent(mainForm);
	}
	
	public void destroyApp(boolean b) { }
	public void pauseApp() { }
}

Step 3: In J2ME, build the project. If you don't get any errors, you can run your program. A frame with a picture of a cellphone should pop up. Click on the button under launch and you should see "Hello World!".

Congratulations! You've just created your own cellphone application!

Step 4: To get it on your cellphone, you'll have to create a package (Project-> Package-> Create Package). See your cellphone's manual for futher instructions on how to put it on your cellphone.


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.