3
我想在ListView中傳遞字符串值。首先我將Bundle中的所有值存儲在Bundle中,通過用戶輸入,然後我嘗試將所有這些值放入String [] Array.It中顯示錯誤,但它沒有顯示, t在仿真器上加載。如何傳遞ListView中的值?
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
Intent myIntent = getIntent();
Bundle b = myIntent.getExtras();
String std = b.getString("std");
String name = b.getString("name");
String lastname = b.getString("lastname ");
String country = b.getString("country ");
String adrs = b.getString("adrs ");
String pro = b.getString("pro");
String pcode = b.getString("pcode");
String[] listItems = new String[7];
listItems[0] = std ;
listItems[1] = name;
listItems[2] = lastname;
listItems[3] = country;
listItems[4] = adrs;
listItems[5] = pro;
listItems[6] = pcode;
ArrayAdapter<String> listItemAdapter = new ArrayAdapter<String>(this
,android.R.layout.simple_list_item_1
,listItems);
ListView lv = (ListView)this.findViewById(R.id.list_view_id);
lv.setAdapter(listItemAdapter);
}
當我的String []寫的所有硬編碼值Array.It告訴我整個list.Please幫助me.Am我想念something.How修復它??我檢查所有的simmilar問題但那一點都不沒有工作。我在Android非常新,所以請幫助我。
您應該添加您獲得錯誤的日誌存在使用任何字符串從包檢查之前。 –
在將它們放入列表之前,您是否嘗試過記錄字符串值? –
是的,我試圖記錄字符串值。 – user1804265