Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8946821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:35:51+00:00 2026-06-15T12:35:51+00:00

I have tried for two days to write a code that dial a phone

  • 0

I have tried for two days to write a code that dial a phone number , but I failed

I have written a midlet and a form called main as a Displayable the form contains a textfield and

command .

When the application starts up the form should appears and calls the dialed number written in

textField when the command pressed.

the dialing process didn’t work with me .

import javax.microedition.io.ConnectionNotFoundException;

import javax.microedition.lcdui.Command; 

import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.Displayable.*;
import javax.microedition.lcdui.Form.*;
 import javax.microedition.midlet.MIDlet;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import javax.microedition.lcdui.*;
 import javax.microedition.midlet.MIDlet;

public class DiallNumber extends MIDlet implements CommandListener
 {
    String num;
 private  Form main;
 private Command call,dial;
 private TextField phoneField;

 Display display;

 public DiallNumber()
    {


 main = new Form("main");
phoneField = new TextField("label","",10,phoneField.PHONENUMBER);
call = new Command("call",call.OK,0);
    main.append(phoneField);
    main.addCommand(call);
    num=this.phoneField.getString().trim();
main.setCommandListener(this);
 }

/**}
 * From MIDlet. Called when the MIDlet is started.
 */
 public void startApp()
 {

 // The initial display is the first form

display = Display.getDisplay(this);
   display.setCurrent(main);





     }

public void call( String number) {
 try {
 platformRequest("tel:"+number);
 } catch (ConnectionNotFoundException ex) {
 // TODO: Exception handling
 }
 }
 public void commandAction(Command c, Displayable d){
     if(d==main)
     {
         if(c==call)

              call(""+num);
     }

 }


 public void pauseApp()
 {
 // No implementation required
 }



/*


 * /
 */


/**
 * From MIDlet. Called to signal the MIDlet to terminate.
 *
* @param unconditional
 * whether the MIDlet has to be unconditionally terminated
 */
 public void destroyApp(boolean unconditional)
 {
 // No implementation required
 }

/**
 * 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
 */



       }

My log trace

Copying 1 file to C:\Users\ELHADI\Documents\NetBeansProjects\DiallNumber2\dist\nbrun5217990045006831680
Copying 1 file to C:\Users\ELHADI\Documents\NetBeansProjects\DiallNumber2\dist\nbrun5217990045006831680
Jad URL for OTA execution: http://localhost:8082/servlet/org.netbeans.modules.mobility.project.jam.JAMServlet/C%3A/Users/ELHADI/Documents/NetBeansProjects/DiallNumber2/dist//DiallNumber2.jad
Starting emulator in execution mode
Installing suite from: http://127.0.0.1:49320/DiallNumber2.jad
[WARN] [rms     ] javacall_file_open: _wopen failed for: C:\Users\ELHADI\javame-sdk\3.0\work\0\appdb\_delete_notify.dat
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:35:52+00:00Added an answer on June 15, 2026 at 12:35 pm

    I have solved the problem

    import javax.microedition.io.ConnectionNotFoundException;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.*;
    import javax.microedition.lcdui.Displayable.*;
    import javax.microedition.lcdui.Form.*;
     import javax.microedition.midlet.MIDlet;
     import java.io.IOException;
     import java.io.InputStreamReader;
     import javax.microedition.lcdui.*;
     import javax.microedition.midlet.MIDlet;
    
    public class DiallNumber extends MIDlet  
     {
    
    
    
    
        private  Display display;
     private MIDlet midlet;
    
    
    Form f = new form("f");
    
    
    
    
    
    
    /**}
     * From MIDlet. Called when the MIDlet is started.
     */
     public void startApp()
     {
    
    
    display = Display.getDisplay(this);
      display.setCurrent(f);
    }
    
    
    
    
    
    
    
    
    
    
     public void pauseApp()
     {
     // No implementation required
     }
    
    
    
    /*
    
    
     * /
     */
    
    
    /**
     * From MIDlet. Called to signal the MIDlet to terminate.
     *
    * @param unconditional
     * whether the MIDlet has to be unconditionally terminated
     */
     public void destroyApp(boolean unconditional)
     {
     // No implementation required
     }
       class form extends   Form  implements CommandListener
    
               {
               private  Command call;
    
                private TextField phoneField;
               private String n;
       public form(String title )
           {
           super(title);
    
           call =new Command("call",call.OK,0);
           this.phoneField =new TextField("number","",20,phoneField.PHONENUMBER);
    
    
       addCommand(call);
       append(this.phoneField);
    
       this.setCommandListener(this);
          }
    
            public void commandAction(Command c,Displayable  d)
           {
    
       if(c==call)
       {
    
    
       try
       {
           n=phoneField.getString().trim();
          platformRequest("tel:"+n);
    
    
       }
      catch(javax.microedition.io.ConnectionNotFoundException e)
      {e.printStackTrace();}
       }
    
    
       }
    
       }
    
    
    
    
           }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried for the last two days to get some code to work,
I have been trying to work on a simple code for two days now.
I have for two days tried to get my program to work, this is
I have now tried to make this work for two days with two different
I have tried everything, searched the net for two hours or even more and
I have tried    to display two spaces in a standard output Java String.
I have two branches master and exp i tried to cherry pick some of
I have two tables: Contestant and Votes Contestant hasMany Votes I've tried doing a
I have two different-sized monitors, connected together using (I believe) TwinView. I tried System.out.println(Toolkit.getDefaultToolkit().getScreenSize());
I have tried searching over the internet about this problem but not able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.