2012-12-22 106 views
4

我想在EditText中得到整個字符串的答案。但我只得到最後一個問題。這可能是因爲它覆蓋了價值。誰能幫我。無法正確打印字符串

 String question[]={ 
      "Is the condition of the security post organized and clean?", 
      "Is the officer aware of the U.S. Security ISO 9001:2008 Quality Program?", 
      "Does the officer have a security officer guidebook?", 
      "Does the officer have a current, valid security guard license?", 
      "Are the post orders complete?", 
      "Are the security officer key goals included in the post orders?", 
      "Is there a client emergency list of phone numbers?", 
      "Has the officer signed off that he/she read and understands the post orders", 
      "Has the officer received US Security Academy training or state mandated training?", 
      "Has the officer received site specific training?", 
      "If the officer drives a vehicle on duty, does he/she have a verified valid drivers license?", 
      "Is the officer in proper uniform?", 
      "Does the officer know the client contact?", 
      "Does the officer know how to contact his/her supervisor?", 
      "Is the site on Post Positive?", 
      "Is the officer trained and knowledgeable on the use of Post Positive?", 
      "Are the daily activity reports up to date?", 
      "Did the inspecting supervisor sign daily activity reports indicating date and time of inspection?", 
      "Does the security officer have any safety or security concerns regarding this client location?", 
    }; 
    for(int i=0;i<19;i++) 
    { 
     //summ+=summ; 
     s=sq[i].split("&"); 


     summ=question[i]+" "+s[0]; 
     //Toast.makeText(getApplicationContext(),summ, Toast.LENGTH_LONG).show(); 
     mQuestions.setText(summ); 
    } 

回答

4

首個解決方案:

使用EditText.append在EditText上增加新的字符串到現有文本

mQuestions.append(summ); 

代替

mQuestions.setText(summ); 

第二方案的:

String summ=""; 
for(int i=0;i<19;i++) 
    { 
     //summ+=summ; 
     s=sq[i].split("&"); 

     summ +=question[i]+" "+s[0]; 

     mQuestions.setText(summ); 
    } 
+0

由於它的工作... :)不能投票了,雖然少的Cuz回購 – Payal

+0

的@ user1747460現在你可以;) – codeMagic

+0

@ user1747460:很高興我能幫忙。 –