Hi there...
I'm a newbie in J2ME.
I plan to make a project about SMS & MMS Layout Animation in Mobile Phone.
Is it possible to make it so?
If yes, would you mind telling me the steps of making its project?
Thanks a lot.

Recommended Answers

All 24 Replies

I plan to make a project about SMS & MMS Layout Animation in Mobile Phone.
Is it possible to make it so?
If yes, would you mind telling me the steps of making its project?

I'm not sure what you talking about. Can you provide more in detail info?

I'm not sure what you talking about. Can you provide more in detail info?

OK, I'll try to explain it
I am a student, and am facing the Final Project in my Campus.
What I'm going to make is SMS & MMS screen which have animation on it.
All of SMS & MMS screen in mobile phone only have plain screen without any animations to make them fun, such as colorful text, moving object. (If the user types the letters, they will move horizontally or vertically or make some moves).
DO you understand what I mean?
(sorry, my English is not so good)

I got that you want to do something with messaging screens, however as before you failed to described the action - what sort of animations you want to do and what sort object movement you looking for.
Lot of things can be done Canvas which obvious, however additional components are uncertain at this point...

ok, canvas only do for screen. and first, I want every letter moves circle or zigzag or else when the user type the letter. Second, The letters should have colorful. Third, there are some tiny objects (like little girl, clown, etc.) flying on top of the screen or something like that, etc.
Is it possible to make like that? (it will make funny)

Yes, all that can be done.

I'm back again...
I wanna ask: How to make the program we make into Installer for example:
*.sis
or
*.jad
or
*.jad
so It can be installed into mobile phone?
Thanks for your reply then...

"sis" is Symbian extension for compiled package
"jad" is auto-generated file by WTK as descriptor file
"jar" is compiled application packed as Java archive file
All of them are automatically created on successful compile by most of the IDEs

Does canvas need database????

Yes and No, depending on what you trying to do

What should I click to make my program into execution file (*.sis or *.jar or *.jad)?

Ehmm compile .... :?:
As I said previously, they are automatically generated on successful compile

I've been searching for that installer, but i didnt find. in which folder?
please let me know....

C O M P I L E

ops.. sorry. don't be mad, sir!
I don't pretend that I don't know.

I'm not mad, I just do not like when people are ignorant to obvious things, especially if was it already discussed

ok, I'm so sorry. Thanks for your answer, by the way...

Thanks for keep answering me.
By the way, when I tried to install the *.jar file of my application to Nokia N80,
It said, It's not compatible.
Do you have any idea about this?
Or, do I have to set something in my program?

If you want you can post your code here and I will try to run it.

Back again...
Please help me.../
It's been 5 months my project in progress, but I haven't finished my project yet. Please somebody help me.
I lost my mind to finish that :((
I've been trying hard even hardest to do my project on time. But I can't finish that. I dont know how what next.
I'm not able to make a program. Please help me.
I'm todly hopeless.................
:((

Back again...
Please help me.../
It's been 5 months my project in progress, but I haven't finished my project yet. Please somebody help me.
I lost my mind to finish that :((
I've been trying hard even hardest to do my project on time. But I can't finish that. I dont know how what next.
I'm not able to make a program. Please help me.
I'm todly hopeless.................
:((

This sort of request will get you nowhere. You missing a description of problem you working, missing relevant coding and description of error or difficulty you facing...

How guys,
Now I'm asking you about this project that I make.
Here's the codes of my SMS Layout Animation:

================================================
import java.util.*;
import java.io.IOException;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.*;
import javax.microedition.midlet.*;

public class SMS extends MIDlet implements CommandListener, Runnable,
	MessageListener {
 
		Display display;
		Form form;
			List menuList; 
			Command exitCom, replyCom, backCom, clrCom, sendCom; 
			TextBox textSmsMasuk, textSmsKeluar; 
			TextField textNo; 
			String port, isiSmsKeluar; 
			Thread thread;
			String[] connections;
			boolean done;
			MessageConnection smsconn;
			Message msg;
 
	public SMS() {
		display = Display.getDisplay(this);
		form = new Form("sms-an Yuk");
		exitCom = new Command("keluar", Command.EXIT, 1);
		replyCom = new Command("balas", Command.SCREEN, 1);
		backCom = new Command("Kembali", Command.BACK, 3);
		clrCom = new Command("Hapus Tulisan", Command.OK, 2);
		sendCom = new Command("Kirim", Command.OK, 1);
		menuList = new List("Menu sms Ku", List.IMPLICIT);
		port = "4321"; 
		textSmsMasuk = new TextBox(null, null, 500, TextField.ANY);
		textSmsKeluar = new TextBox("Silakan Menulis Sms", null,
		500, TextField.ANY);
		textNo = new TextField("Masukan Nomor Tujuan", "",
		15, TextField.PHONENUMBER);
	}
 
	public void startApp() {
		bukaKoneksi(); 
		menu(); 
	}
 
	public void pauseApp() {
	}
 
	public void destroyApp(boolean unconditional) {
 
		
		done = true;
		thread = null;
		if (smsconn != null) {
		try {
			smsconn.close();
			} catch (IOException e) {
				}		
		}	
 
	
	notifyDestroyed();
	}
 
	public void menu() { 
		menuList.append("Tulis Sms", null);
		menuList.append("about", null);      
		menuList.append("Keluar", null);     
		menuList.addCommand(exitCom);  
		menuList.setCommandListener(this);
		display.setCurrent(menuList);
	}
 
	public void tulisSms() { 
		textSmsKeluar.addCommand(sendCom); 
		textSmsKeluar.addCommand(clrCom);  
		textSmsKeluar.addCommand(backCom); 
		textSmsKeluar.setCommandListener(this);
		display.setCurrent(textSmsKeluar);
	}

	public void masukNo() { 
		form.setTitle("Sms Siap dikirim"); 
		form.append(textNo); 
		form.addCommand(backCom); 
		form.addCommand(sendCom); 
		form.setCommandListener(this);
		display.setCurrent(form);
	}
 
	public void kirim() { 
		new Thread(new Runnable() {
		//perhatiin ya
			public void run() {
				try {
					String isiSms = isiSmsKeluar;
					String noTujuan = textNo.getString();
					String address = "sms://" + noTujuan + ":" + port;
					MessageConnection smsConnKir = null;
					Message isiSmsNya = null;
					smsConnKir = (MessageConnection) Connector.open(address);
					TextMessage txtmessage =
					(TextMessage) smsConnKir.newMessage(MessageConnection.TEXT_MESSAGE);
					txtmessage.setAddress(address);
					txtmessage.setPayloadText(isiSms);
					isiSmsNya = txtmessage;
					smsConnKir.send(isiSmsNya); 
				} catch (Throwable t) {
									t.printStackTrace();
									}
			}
		}).start();
	}
 
	public void terima(String isi, String no, Date tgl) { 
		String nonya = fixNomer(no);
		textSmsMasuk = new TextBox("Sms dari:" + nonya + " " + tgl, isi,
		isi.length(), TextField.ANY);
		textSmsMasuk.addCommand(replyCom);
		textSmsMasuk.addCommand(exitCom);
		textSmsMasuk.setCommandListener(this);
		display.setCurrent(textSmsMasuk);
	}
 
	public void bukaKoneksi() { 
		String smsConnection = "sms://:" + port;
		done = true;
		thread = null;
		 
		try {
				smsconn = (MessageConnection) Connector.open(smsConnection);
				smsconn.setMessageListener(this);
		} catch (IOException ioe) {
			ioe.printStackTrace();
			}
 
		connections = PushRegistry.listConnections(true);
	 
		done = false;
		thread = new Thread(this);
		thread.start();
	}
 
	public void tutupKoneksi() { 
		try {
		smsconn.close();
		} catch (IOException e) {
				}
	}
 
	public String fixNomer(String no) {
	
 
		String hs = null;
		hs = no.substring(6, no.length());
		return hs;
	}	

	public void commandAction(Command c, Displayable d) {
		if (c == exitCom) {
		destroyApp(true);
		}
		if (d == menuList) {
		if (menuList.isSelected(0)) {
					tulisSms();
		} else if (menuList.isSelected(1)) {
				Alert about = new Alert("About", "Aplikasi SMS",
				null, AlertType.INFO);
				display.setCurrent(about);
			} else if (menuList.isSelected(2)) {
				destroyApp(true);
				}
		}
		
			if (d == textSmsKeluar) {
			if (c == sendCom) {
				form.deleteAll();
				masukNo();
				} else if (c == clrCom) {
					textSmsKeluar.setString("");
					} else if (c == backCom) {
						display.setCurrent(menuList);
						}
			}
			
			if (d == textSmsMasuk) {
				if (c == exitCom) {
					display.setCurrent(menuList);
				} else if (c == replyCom) {
					tulisSms();
						}
			}
			
			if (d == form) {
				if (c == backCom) {
					form.deleteAll();
					display.setCurrent(textSmsKeluar);
				} else if (c == sendCom) {
					isiSmsKeluar = textSmsKeluar.getString();
					textSmsKeluar.setString("");
					kirim();
					}
			}
	}
 
	public void run() { 
		try {
			msg = smsconn.receive();
			String senderAddress = msg.getAddress();
			Date waktuSms = msg.getTimestamp();
				if (msg instanceof TextMessage) {
					String isiSmsMasuk = ((TextMessage) msg).getPayloadText();
					terima(isiSmsMasuk, senderAddress, waktuSms);
				}
			tutupKoneksi();
			bukaKoneksi();
		} catch (IOException e) {
			}
	}
 
	public void notifyIncomingMessage(MessageConnection conn) {
		if (thread == null) {
			done = false;
			thread = new Thread(this);
			thread.start();
		}
	}
}

================================================
I wanna ask:
How's the code to make animation when the user type the letter?
Or
Is the animation need library? if yes, how?

Please help me....

Few things

  1. Next time you post any code use code tags as [code=java]YOUR CODE HERE [/code]
  2. Animation is not one of Java Microedition libraries so you will have to do you effects manually through
    • Graphics class also if you wish you can use capacities of JSR 135 Mobile Media API with add on of JSR 234 Advanced Multimedia Supplements
    • or you can call upon Capuchine project and see what sort of options you can get from that environment
  3. Code structure, is something you should look into
    • your code at this point has already 250 lines
    • you are nowhere to finish it yet (it will grow even more) and it will become difficult to manage (example scrolling down to check error at line 234 just to find that actual line is pointing toward method on line 456, it is just plain nightmare)
    • you are accommodating multiple screen view where each of them should be in their own class and supporting functionality should be in their own classes too

    Have look at this post from JavaRanch how to effectively manage multiple screens of the application

Ok, Thanks a lot for your reply.
And Now, I'm trying to make the screen connects to next screen.
Here's the code:

WELCOME SCREEN

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class PWelcomeScreen extends MIDlet
  implements CommandListener {
	
  private Display display;
  private Form form;
   private Alert alert;
  private Command cmdKeluar;
  private Command cmdAlert;

  // constructor
  public PWelcomeScreen() {

    display = Display.getDisplay(this);

    // membuat form
    form = new Form("Selamat Datang");

    // menambahkan teks ke dalam form
    form.append("Aplikasi Animasi Layar SMS & MMS");

    // membuat dua buah Command, "Keluar" dan "Alert"
    cmdKeluar = new Command("Keluar", Command.EXIT, 1);
    cmdAlert  = new Command("Alert", Command.SCREEN, 2);

    // menambahkan Command ke dalam form
    form.addCommand(cmdKeluar);
    form.addCommand(cmdAlert);
    form.setCommandListener(this);
  }
	
  public void startApp() {
    display.setCurrent(form);
  }
	
  public void pauseApp() {
  }
	
  public void destroyApp(boolean unconditional) {	
  }

  // mendefinisikan method untuk membuat dan menampilkan Alert	
  private void showAlert() {
    String info = "Selamat menggunakan " +
                  "Animasi Layar SMS & MMS ";                  ;

    // membuat instance dari kelas Alert
    alert = new Alert("Informasi", info, 
                      null, AlertType.ALARM);

    // mengeset berapa lama Alert akan ditampilkan 
    alert.setTimeout(5000);  // 5000 berarti 5 detik

    // menampilkan Alert
    display.setCurrent(alert, form);
  }
	
  public void commandAction(Command c, Displayable s) {
    if (c == cmdKeluar) {
      destroyApp(true);
      notifyDestroyed();
    } else if (c == cmdAlert) {
      // memanggil method showAlert()
      showAlert();
    }
  }	
}

PILIHAN PESAN

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class PPilihanPesan extends MIDlet 
  implements CommandListener {
	
  private Display display;
  private List list;
  
  private Command cmdPilih;
  private Command cmdKembali;  
  
  public PPilihanPesan() {
  	display = Display.getDisplay(this);
  }
  
  public void startApp() {
  	
  	// membuat daftar command yang akan digunakan
  	cmdPilih = new Command("Pilih", Command.SCREEN, 2);
  	cmdKembali = new Command("Kembali", Command.EXIT, 1);
  	  	
  	// membuat gambar icon untuk setiap item List
  	Image img;
  	try {
  		img = Image.createImage("/app.png");
  	} catch (Exception e) {
  		img = null;
  	}
  	
  	// membuat List dengan tipe EXCLUSIVE
  	list = new List("Silakan Pilih", Choice.EXCLUSIVE);
  	list.append("Pesan Singkat (SMS)", img);
  	list.append("Pesan Multimedia (MMS)", img);
  	list.addCommand(cmdPilih);
  	list.addCommand(cmdKembali);
  	list.setCommandListener(this);
  	
  	display.setCurrent(list);
  }
  
  public void pauseApp() {
  	//
  }
  
  public void destroyApp(boolean unconditional) {
  	notifyDestroyed();
  }
  
  public void commandAction(Command c, Displayable s) {
  	if (c == cmdKembali) {
  		destroyApp(false);
  	} else {
  		int indeks = list.getSelectedIndex();
  		Alert info = new Alert("Informasi");
  		info.setString("Anda memilih: " + 
list.getString(indeks));
  		info.setTimeout(Alert.FOREVER);
  		display.setCurrent(info, list);
  	}
  }

}

PILIHAN LAYAR ANIMASI SMS

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class PJenisLayarAnimasiMMS extends MIDlet 
  implements CommandListener {
	
  private Display display;
  private List list;
  
  private Command cmdPilih;
  private Command cmdKembali;  
  
  public PJenisLayarAnimasiMMS() {
  	display = Display.getDisplay(this);
  }
  
  public void startApp() {
  	
  	// membuat daftar command yang akan digunakan
  	cmdPilih = new Command("Pilih", Command.SCREEN, 2);
  	cmdKembali = new Command("Kembali", Command.EXIT, 1);
  	  	
  	// membuat gambar icon untuk setiap item List
  	Image img;
  	try {
  		img = Image.createImage("/app.png");
  	} catch (Exception e) {
  		img = null;
  	}
  	
  	// membuat List dengan tipe EXCLUSIVE
  	list = new List("Silakan Pilih Layar Animasi MMS", Choice.EXCLUSIVE);
  	list.append("Layar Animasi MMS 1", img);
  	list.append("Layar Animasi MMS 2", img);
	list.append("Layar Animasi MMS 3", img);
  	list.append("Layar Animasi MMS 4", img);
	list.append("Layar Animasi MMS 5", img);
  	list.addCommand(cmdPilih);
  	list.addCommand(cmdKembali);
  	list.setCommandListener(this);
  	
  	display.setCurrent(list);
  }
  
  public void pauseApp() {
  	//
  }
  
  public void destroyApp(boolean unconditional) {
  	notifyDestroyed();
  }
  
  public void commandAction(Command c, Displayable s) {
  	if (c == cmdKembali) {
  		destroyApp(false);
  	} else {
  		int indeks = list.getSelectedIndex();
  		Alert info = new Alert("Informasi");
  		info.setString("Anda memilih: " + 
list.getString(indeks));
  		info.setTimeout(Alert.FOREVER);
  		display.setCurrent(info, list);
  	}
  }

}

PILIHAN LAYAR ANIMASI MMS

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class PJenisLayarAnimasiSMS extends MIDlet 
  implements CommandListener {
	
  private Display display;
  private List list;
  
  private Command cmdPilih;
  private Command cmdKembali;  
  
  public PJenisLayarAnimasiSMS() {
  	display = Display.getDisplay(this);
  }
  
  public void startApp() {
  	
  	// membuat daftar command yang akan digunakan
  	cmdPilih = new Command("Pilih", Command.SCREEN, 2);
  	cmdKembali = new Command("Kembali", Command.EXIT, 1);
  	  	
  	// membuat gambar icon untuk setiap item List
  	Image img;
  	try {
  		img = Image.createImage("/app.png");
  	} catch (Exception e) {
  		img = null;
  	}
  	
  	// membuat List dengan tipe EXCLUSIVE
  	list = new List("Silakan Pilih Layar Animasi SMS", Choice.EXCLUSIVE);
  	list.append("Layar Animasi SMS 1", img);
  	list.append("Layar Animasi SMS 2", img);
	list.append("Layar Animasi SMS 3", img);
  	list.append("Layar Animasi SMS 4", img);
	list.append("Layar Animasi SMS 5", img);
  	list.addCommand(cmdPilih);
  	list.addCommand(cmdKembali);
  	list.setCommandListener(this);
  	
  	display.setCurrent(list);
  }
  
  public void pauseApp() {
  	//
  }
  
  public void destroyApp(boolean unconditional) {
  	notifyDestroyed();
  }
  
  public void commandAction(Command c, Displayable s) {
  	if (c == cmdKembali) {
  		destroyApp(false);
  	} else {
  		int indeks = list.getSelectedIndex();
  		Alert info = new Alert("Informasi");
  		info.setString("Anda memilih: " + 
list.getString(indeks));
  		info.setTimeout(Alert.FOREVER);
  		display.setCurrent(info, list);
  	}
  }

}

Here's the flow screen:

WELCOME SCREEN (PWelcomeScreen.java)
--->PILIHAN PESAN (PPilihanPesan.java)
---------->1) PESAN SINGKAT SMS
-------------------------------> PILIHAN LAYAR ANIMASI SMS (JenisLayarAnimasiSMS.java)
---------->2) PESAN SINGKAT MMS
-------------------------------> PILIHAN LAYAR ANIMASI MMS (JenisLayarAnimasiMMS.java)

You misunderstand the concept showed in that link. There is only one class that extends MIDlet and has all MIDlet methods (startApp(), pauseApp(), destroyApp()) and other classes only extends one of subclasses for Screen or Canvas.
Please correct your code in that manner

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.