2011-10-06 67 views
0

我使用kxml解析器從遠程服務器解析xml。我正在使用以下代碼來解析xml在J2ME中解析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));來顯示加載表單,但它沒有顯示加載表單。那我該如何解決這個問題呢?

回答

1

你可以,如果使用NetBeans然後 轉到庫 - 烏爾使用GIF文件加載屏幕

Here你可以找到示例代碼

>添加Netbeans的MIDP compaonent

U」將獲得netbeans.splachscreen,netbeans.waitingsceen 你可以使用和集成在你的代碼