- 我有一個包含了幾個小工具的XML配置文件包括微調
- 我想顯示的微調字符串列表,在運行時生成的列表作爲函數的結果,因此不能在arrays.xml中。
我試着這樣做:如何使用Spinner.setAdapter在Spinner中顯示字符串數組?
String[] SpinnerItems = GetMyCustomItems();
((Spinner)findViewById(R.id.MySpinner)).setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1,SpinnerItems));
但這種崩潰我的應用程序。
完成此操作的正確方法是什麼?
您可以發佈它在logcat中打印出錯誤堆棧? – m6tt 2010-06-09 09:52:04