×
Namespaces

Variants
Actions
(Difference between revisions)

Realizando Chamadas Telefônicas Utilizando TextField

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Fix translation link)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Fix metadata)
Line 1: Line 1:
 
[[Category:Java ME]][[Category:Code Snippet]][[Category:Lang-Portuguese]]
 
[[Category:Java ME]][[Category:Code Snippet]][[Category:Lang-Portuguese]]
{{ArticleMetaData <!-- v1.2 -->
+
{{ArticleMetaData <!-- v1.3 -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|devices= Nokia N95 8GB
 
|devices= Nokia N95 8GB
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|platform= S60 3rd Edition, FP1
 
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
+
|capabilities= <!-- Required capabilities for code (e.g. ID_CAP_LOCATION, ID_CAP_NETWORKING) -->
|keywords= javax.microedition.lcdui.TextField
+
 
|language= Lang-Portuguese
 
|language= Lang-Portuguese
 
|translated-by= [[User:Thiagobrunoms]]
 
|translated-by= [[User:Thiagobrunoms]]
Line 22: Line 19:
 
|author= [[User:Tapla]]
 
|author= [[User:Tapla]]
 
<!-- The following are not in current metadata -->
 
<!-- The following are not in current metadata -->
|subcategory= Telephony
 
 
|id= CS000955
 
|id= CS000955
 +
|platform= S60 3rd Edition, FP1
 
}}
 
}}
  
Line 92: Line 89:
 
==Veja também==
 
==Veja também==
  
* [[Archived:Making a phone call programmatically using platformRequest() in Java ME]]
+
* [[Making a phone call programmatically using platformRequest() in Java ME]]
  
  
  
  
<!-- Translation --> [[en:Making a phone call using TextField in Java ME]]
+
<!-- Translation --> [[en:Making a phone call using TextField in Java ME]][[Category:Code Snippet]] [[Category:Nokia Belle]] [[Category:S60 3rd Edition FP1]] [[Category:MIDP 2.0]] [[Category:Telephony on Java ME]] [[Category:S60 5th Edition]] [[Category:Series 40]] [[Category:Series 40 3rd Edition (initial release)]] [[Category:Series 40 5th Edition (initial release)]] [[Category:Series 40 Developer Platform 1.0]] [[Category:Symbian]] [[Category:Symbian Anna]] [[Category:Java Runtime 2.3 for Symbian]] [[Category:Series 40 6th Edition (initial release)]] [[Category:S60 3rd Edition FP2]] [[Category:S60 3rd Edition (initial release)]] [[Category:Symbian^3]]

Revision as of 06:51, 23 October 2013

Contents

Introdução

Este exemplo demonstra como realizar chamadas telefônicas utilizando o componente de tela TextField. A MIDlet constrói este componente para adicionar o número do telefone na tela. O usuário pode adicionar o número ou obtê-lo a partir da lista de contatos do dispositivo. Após isso, o usuário pode selecionar Opções > Chamar para realizar a ligação.

Código-fonte

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class ExampleMIDlet extends MIDlet implements CommandListener {
private Command exitCommand;
private Form mainForm;
 
/**
* Constructor. Constrói os objetos e inicializa os objetos displayables
*/

public ExampleMIDlet() {
mainForm = new Form("ExampleMIDlet");
 
// Cria um campo para números de telefone.
mainForm.append(new TextField("Número do telefone", null, 20,
TextField.PHONENUMBER));
 
exitCommand = new Command("Sair", Command.EXIT, 0);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
}
 
/**
* Invocado quando a MIDlet é inicializada
*/

public void startApp() {
Display.getDisplay(this).setCurrent(mainForm);
}
 
// Outros métodos da MIDlet omitidas.
// ...
 
/**
* From CommandListener.
* Invocado pelo gerenciador de aplicativos a partir de um evento de algum comando
* particular displayable.
* @param command o objeto Command que recebeu o evento
* @param displayable o objeto displayable no qual o comando foi invocado
*/

public void commandAction(Command command, Displayable displayable) {
if (command == exitCommand) {
// Finaliza a MIDlet
destroyApp(true);
notifyDestroyed();
}
}

Pós-condições

O campo para o número de telefone é mostrado na tela. O usuário pode adicionar o número do telefone e selecionar Opções > Chamar para realizar a chamada.

Veja também

95 page views in the last 30 days.