×
Namespaces

Variants
Actions
(Difference between revisions)

Making a phone call using TextField in Java ME

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update)
Line 1: Line 1:
[[Category:Java ME]][[Category:MIDP 2.0]][[Category:Code Examples]][[Category:Telephony]][[Category:S60 3rd Edition FP1]][[Category:Code Snippet]]
+
{{Archived|timestamp=20120313130308|user=roy.debjit| }}
__NOTOC__
+
[[Category:Java ME]][[Category:MIDP 2.0]][[Category:Code Snippet]][[Category:Telephony]][[Category:S60 3rd Edition FP1]][[Category:Code Snippet]]
__NOEDITSECTION__
+
{{ArticleMetaData <!-- v1.2 -->
{{KBCS}}
+
{{ArticleMetaData
+
|id=CS000955
+
|platform=S60 3rd Edition, FP1
+
|devices=Nokia N95 8GB
+
|category=Java ME
+
|subcategory=Telephony
+
|creationdate=May 14, 2008
+
|keywords=javax.microedition.lcdui.TextField
+
 
+
 
|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]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
+
|devices= Nokia N95 8GB
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
+
|platform= S60 3rd Edition, FP1
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|author=[[User:Tapla]]
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= javax.microedition.lcdui.TextField
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080507
 +
|author= [[User:Tapla]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= Telephony
 +
|id= CS000955
 
}}
 
}}
{{Archived|timestamp=20120313130308|user=roy.debjit| }}
 
 
    
 
    
 
==Overview==
 
==Overview==
  
This snippet demonstrates how to make a phone call by using a <tt>TextField</tt>. The MIDlet constructs a phone number field and displays it on the screen. The user may enter a phone number into it or obtain one from the Contacts list. After that, he or she can select <tt>Options</tt> > <tt>Call</tt> to call that number.
+
This snippet demonstrates how to make a phone call by using a {{Icode|TextField}}. The MIDlet constructs a phone number field and displays it on the screen. The user may enter a phone number into it or obtain one from the Contacts list. After that, he or she can select {{Icode|Options}} > {{Icode|Call}} to call that number.
  
 
==Source==
 
==Source==
Line 86: Line 91:
 
==Postconditions==
 
==Postconditions==
  
A phone number field is displayed on the screen. The user can enter a phone number and select <tt>Options</tt> > <tt>Call</tt> to call that number.
+
A phone number field is displayed on the screen. The user can enter a phone number and select {{Icode|Options}} > {{Icode|Call}} to call that number.
  
 
==See also==
 
==See also==
  
* [[Making a phone call: Platform request]]
+
* [[CS000956 - Making a phone call programmatically using platformRequest() method]]

Revision as of 07:05, 10 May 2012

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata

Contents

Overview

This snippet demonstrates how to make a phone call by using a TextField. The MIDlet constructs a phone number field and displays it on the screen. The user may enter a phone number into it or obtain one from the Contacts list. After that, he or she can select Options > Call to call that number.

Source

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. Constructs the object and initializes displayables.
*/

public ExampleMIDlet() {
mainForm = new Form("ExampleMIDlet");
 
// Create a phone number field, which allows a call to be made
mainForm.append(new TextField("Phone number", null, 20,
TextField.PHONENUMBER));
 
exitCommand = new Command("Exit", Command.EXIT, 0);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
}
 
/**
* Called when the MIDlet is started.
*/

public void startApp() {
Display.getDisplay(this).setCurrent(mainForm);
}
 
// Other inherited methods omitted for brevity
// ...
 
/**
* From CommandListener.
* Called by the system to indicate that a command has been invoked on a
* particular displayable.
* @param command the command that was invoked
* @param displayable the displayable where the command was invoked
*/

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

Postconditions

A phone number field is displayed on the screen. The user can enter a phone number and select Options > Call to call that number.

See also

243 page views in the last 30 days.
×