2011-09-08 32 views
0

在下面的代碼中,我從數據庫中獲得了該值並顯示在微調器中。並且單擊微調器中的值時必須顯示一些數據,但是我的問題是僅顯示數據的最後一行。如果你幫助我,我會很高興。想要在調用函數後能夠看到完整的數據

SpSites.setOnItemSelectedListener(新OnItemSelectedListener(){

public void onItemSelected(AdapterView<?> arg0, View arg1,int arg2, long arg3) { 
     Object itemName = SpSites.getSelectedItem(); 
     String strselectedName = itemName.toString(); 

      for(int i = 0; i < siteName.length; i++){ 
       if(siteName[i].equalsIgnoreCase(strselectedName)){ 
        detailEmployee = gd.selectPhoneDirectory(siteId[i]);//detailEmployee is string array 
        //Toast.makeText(Directory.this,detailEmployee[i], Toast.LENGTH_LONG).show();   

       } 
       for(int j = 0;j<detailEmployee.length;j++){ 
        Toast.makeText(Directory.this,detailEmployee[j], Toast.LENGTH_LONG).show(); 
        System.out.println("Data :"+detailEmployee[j]); 
       } 
      } 
     } 

回答

0

一切都被顯示在同一個地方,你只能看到,因爲它在別人的頂部顯示的最後一個元素。使用一個字符串生成器來concstenate所有的項目在最後一個for,然後做一個Toast.show()

+0

沒有得到你... –

+0

多個麪包對話框,所有相同的地方 –

+0

它沒有解決我的問題 –