1

我有一个这段代码,如果 xml 响应高于 4 但不打印标签 No Recent Transection 如果值低于或等于 4 这行是获取字符串长度的正确格式?xmlResponse.length<=4?

xmlResponse = www.xyz.xml

 if(xmlResponse.length<=4)
         {

             lblTMSNoRecentTransaction = (TextView) 
   findViewById(R.id.lblTMSNoRecentTransaction);
             lblTMSNoRecentTransaction.setText("No Recent 
     Transactions" );


         }

         else
         {
        //     for (int x=1;x<=xmlResponse.length;)
                {
                 lblTMSCustomTransactionDate = (TextView) 
   findViewById(R.id.lblTMSCustomTransactionDate);
                 lblTMSCustomTransactionDate.setText("Transaction Date :   
  "     + xmlResponse[5][1] );




                 lblTMSCustomAmount = (TextView) 
   findViewById(R.id.lblTMSCustomAmount);
                 lblTMSCustomAmount.setText("Amount : " +   
   xmlResponse[6][1] );



                 lblTMSCustomTransactionDate2 = (TextView)  
   findViewById(R.id.lblTMSCustomTransactionDate2);
                 lblTMSCustomTransactionDate2.setText("Transaction Date : " + xmlResponse[8][1] );




                 lblTMSCustomAmount2 = (TextView) 
    findViewById(R.id.lblTMSCustomAmount2);
                 lblTMSCustomAmount2.setText("Amount : " + 
    xmlResponse[9][1] );




                 lblTMSCustomTransactionDate3 = (TextView)  
  findViewById(R.id.lblTMSCustomTransactionDate3);
                 lblTMSCustomTransactionDate3.setText("Transaction Date : " + xmlResponse[11][1] );




                 lblTMSCustomAmount3 = (TextView)    
 findViewById(R.id.lblTMSCustomAmount3);
                 lblTMSCustomAmount3.setText("Amount : " + 
 xmlResponse[12][1] );



                }

                     }
4

0 回答 0