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

发布于 2024-12-08 07:40:09 字数 1652 浏览 1 评论 0原文

我正在使用 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 时显示从另一个类加载表单。我尝试过 Display.getDisplay(parent).setCurrent(new LoadingBarCanvas(parent)); 显示加载表单,但它不显示加载表单。那么我该如何解决这个问题呢?

I am parsing xml from remote server using kxml parser. I am using the following code to parse 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();
    }
}

I want to show loading Form from another class while xml is parsing. I have tried Display.getDisplay(parent).setCurrent(new LoadingBarCanvas(parent)); to display loading form but it don't show the loading Form. So how can I solve this problem ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无言温柔 2024-12-15 07:40:09

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

在这里您可以找到 示例代码

如果您使用 Netbeans 那么
转到库->添加 Netbeans MIDP 组件,

您将获得 netbeans.splachscreen、netbeans.waitingsceen 类
您可以使用并集成到您的代码中

you can use the GIF file for loading screen

Here you can find the sample code

if u r using the Netbeans then
Go to library->Add Netbeans MIDP compaonent

U'll get the class of netbeans.splachscreen,netbeans.waitingsceen
Which u can use and integrate in ur code

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文