【问题标题】:displaying an alert on call of a process in j2me在 j2me 中显示进程调用警报
【发布时间】:2014-05-20 09:14:11
【问题描述】:

我正在开发诺基亚 e71 的应用程序。我想在调用 Locfinder.ex() 函数并返回位置值之间的时间间隔显示警报。我需要创建一个单独的线程吗? 我对 Java 很陌生,所以仍然不清楚所有概念。我在这里粘贴我的代码。请提供一些建议。

   /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */

  package org.ets.screen;
  import javax.microedition.lcdui.Command;
  import javax.microedition.lcdui.CommandListener;
  import javax.microedition.lcdui.Displayable;
  import javax.microedition.lcdui.Form;
  import javax.microedition.lcdui.TextField;
  import org.ets.midlet.ETS_infozech;
  import org.ets.utils.Chacheck;
  import org.ets.utils.Constants;
  import org.ets.utils.Locfinder;
  import org.ets.utils.TextMessageSender;


  /**
  *
  * @author Deepshikha
  * Purpose:for Check_out form
  * Date:21-April-2014
  * 
  * Modified by:Deepshikha Date:-16-May-2014 Purpose:-to add geotagging
  */
  public class check_out extends Form implements CommandListener{

private TextField txtSapId;
private Command send, back;
String smsTxt;
String smsNumber = Constants.phone_Number;
TextMessageSender sendMessage;
ETS_infozech midlet;

public check_out(ETS_infozech midlet) {
    super("Check_out Details"); //for the constructor of Form class
    this.midlet = midlet;

    txtSapId = new TextField("SAP ID:", "", 15, TextField.ANY); // for SAP ID

    send = new Command("Send", Command.OK, 1);
    back = new Command("Back", Command.BACK, 2);

    sendMessage = new TextMessageSender(midlet);

    append("Please Enter Detail");
    append("");
    append(txtSapId);
    append("");
    addCommand(send);
    addCommand(back);
    setCommandListener(this);

}

 public void commandAction(Command c, Displayable d) {
    if (c == send) {
        String valSapId = txtSapId.getString();

        if (valSapId.length() <= 0) {
            midlet.showalert("Please enter SAP ID");
        }



        else {
             int a;
             a=Chacheck.check(valSapId);//to valiadmindate SAPId field
             if (a==1){


                 midlet.showalert("Remove White space from SAPID!!!");

             }
             else if(a==2){

                 midlet.showalert("Symbols in sapid textbox!!!");

             }
             else{

                 smsTxt = "FNX COUT " + "SAPID-" + valSapId ;


                String s=Locfinder.ex();
                if(s==null){
                    midlet.showConfirm(smsTxt);

                }

                else{
                smsTxt=smsTxt+s;
                System.out.println(smsNumber + " ******** " + smsTxt);
                sendMessage.sendTextMessage(Constants.phone_Number, smsTxt);// for sending message with required string and MSISDN no.

                }
                }        
        }
    } else if (c == back) {
        midlet.showMainMenu();
    }
}

}

【问题讨论】:

    标签: multithreading background java-me alert


    【解决方案1】:

    您可以让 Locfinder.ex() “同步”,在该函数中,第一行应该是 showProgressBar(),最后一行应该是 destroyProgressBar()。就是这样。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多