在J2ME中解析XML时显示加载表单

时间:2011-10-06 05:51:37

标签: java-me midp-2.0 lcdui kxml2

我正在使用kxml解析器从远程服务器解析xml。我使用以下代码来解析xml

public void validateUser(String name, String password, String mobile, String code) 
{
    Display.getDisplay(parent).setCurrent(new LoadingBarCanvas(parent));
    ReadXML xmlThread = new ReadXML();
    xmlThread.start();
    int count = 0;
    URL = "http://www.acb.info/mobapp/Web_service/checkLogin.php?mobile=" + mobile + "&userId=dbz&password=123&code=" + code + "&output=xml";
    while (xmlThread.isAlive()) 
    {
        if (count == 0) 
        {
            System.out.println("thread is alive");
        }
        count++;
    }

    StringBuffer sb = new StringBuffer();
    System.out.println("bookVector " + bookVector.size());
    for (int i = 0; i < bookVector.size(); i++) {
        ChapterClass book = (ChapterClass) bookVector.elementAt(i);
        sb.append("\n");
        sb.append("Name : ");
        sb.append(book.getName());
        status = book.getName();
        sb.append("\n");
        sb.append("Descrition : ");
        sb.append(book.getDescription());
        smcID = book.getDescription();
        userName.setString(book.getRating());
                //=book.getRating();
        sb.append("\n");

    }
    System.out.println(sb.toString());


    if (status.equalsIgnoreCase("Sucess..")) 
    {

        StoreData("smcid",smcID);
        StoreData("userid",userName.getString());

        showInputLogInSuccessfull();
    } 
    else 
    {
        showInputLogInFailed();
    }
}

我希望在xml解析时显示从另一个类加载Form。我已经尝试Display.getDisplay(parent).setCurrent(new LoadingBarCanvas(parent));来显示加载表单,但它没有显示加载表单。那我怎么解决这个问题呢?

1 个答案:

答案 0 :(得分:1)

您可以使用GIF文件加载屏幕

Here您可以找到示例代码

如果你使用Netbeans那么 转到库 - >添加Netbeans MIDP同行

你会得到netbeans.splachscreen,netbeans.waitingsceen的课程 你可以使用和集成在你的代码中