Alguém teria um código de um método que retorna o horário (hora, minuto e segundos se possível) do celular?
Obrigado.
Alguém teria um código de um método que retorna o horário (hora, minuto e segundos se possível) do celular?
Obrigado.
[code]
import java.util.;
import javax.microedition.lcdui.;
import javax.microedition.midlet.*;
public class DateToday extends MIDlet implements CommandListener{
private Display display;
private Form form;
private Date today;
private Command exit;
private DateField dateField;
public DateToday(){
display = Display.getDisplay(this);
form = new Form("Data de hoje");
today = new Date(System.currentTimeMillis());
dateField = new DateField("", DateField.DATE_TIME);
dateField.setDate(today);
exit = new Command("Sair", Command.EXIT, 1);
form.append (dateField);
form.addCommand(exit);
form.setCommandListener(this);
}
protected void startApp() {
display.setCurrent(form);
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void destroyApp(boolean arg0) {
// TODO Auto-generated method stub
}
public void commandAction(Command command, Displayable displayable){
if (command == exit){
destroyApp(true);
notifyDestroyed();
}
}
}[/code]