AntiGuide: JavaAppel



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.216.172 :: Signaler un abus :: le: 20250806 13:21:11

lu: http://developer.sonyericsson.com/getDocument.do?docId=66910
/*
 * By: Oscar Wivall
 * Date: 2004-08-11
 *
 * Description: platformRequest demonstration.
 *
 * Company: Metrowerks
 *
 */

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

/*
 * Creates a TextBox where the user can enter a url or a phonenumber.
*/
public class platformRequestExample extends MIDlet implements CommandListener {
    
    private TextBox mTextBox;
    private Command URLCommand;
    private Command DialCommand;
    private Command ExitCommand;
    private Command OKCommand;
    
    private int type = 0;
    
    public platformRequestExample(){
        mTextBox = new TextBox("Enter Phone number:", "", 100, TextField.PHONENUMBER);

        URLCommand = new Command("URL", Command.SCREEN, 1);
        DialCommand = new Command("Dial", Command.SCREEN, 1);
        ExitCommand = new Command("Exit", Command.EXIT, 0);
        OKCommand = new Command("Submit", Command.OK, 0);
        
        mTextBox.addCommand(ExitCommand);
        mTextBox.addCommand(OKCommand);
        mTextBox.addCommand(DialCommand);
        mTextBox.addCommand(URLCommand);
        mTextBox.setCommandListener(this);
    }
    
       
    public void startApp() {
        Display.getDisplay(this).setCurrent(mTextBox);
    }
    
    public void pauseApp() {
        
    }
    
    public void destroyApp(boolean unconditional) {
        
    }
    
    public void commandAction(Command c, Displayable d){
        if(c.getCommandType() == Command.EXIT){
            notifyDestroyed();
        }else if(c.getCommandType() == Command.OK){
            if(type == 0){
                try{
                    platformRequest("tel:" + mTextBox.getString()); // dial the phonenumber.
                }catch(Exception e){}
            }else{
                try{
                    platformRequest(mTextBox.getString()); // open the wap browser.
                }catch(Exception e){}
            }
            
            // Switch between Phonenumber and URL textbox
        }else if(c == DialCommand){
            mTextBox.setConstraints(TextField.PHONENUMBER);
            mTextBox.setTitle("Enter Phone number:");
            mTextBox.setString("");
            type = 0;
        }else if(c == URLCommand){
            mTextBox.setConstraints(TextField.URL);
            mTextBox.setTitle("Enter a URL:");
            mTextBox.setString("http://");
            type = 1;
        }
    }
    
}



se compile sans d'erreur,
sur Nokia2610, c'est mieux, on passe par des dialogues "autoriser appel", et "raccrocher avant de continuer" qui ne sont pas dans mon source, ...
mais l'appel n'a pas abouti
voir syntaxe de tel:


sur la carte 3G Orange (exécuté en debug sous NetBeans) , dit pas supporté