【发布时间】:2011-03-12 05:51:13
【问题描述】:
我想从数据库中获取数据并在微调器中显示。 但它无法正常工作并使我的应用程序崩溃。 所以我恳请您,如果您有好的解决方案,请发送给我。
【问题讨论】:
-
ArrayAdapter
arr_adp= new ArrayAdapter (this, android.R.layout.simple_spinner_item); sp.setAdapter(arr_adp); arr_adp.setDropDownViewResource(android.R.layout.simple_spinner_item);试试 { db.open();光标 cur=db.GetStudent(); int cur_item=cur.getCount(); if(cur.moveToFirst()) { 做 { arr_adp.add(cur.getString(0)); } while(cur.moveToNext()); } db.close(); } catch (Exception e) { Toast.makeText(this, "异常句柄"+e.toString(), Toast.LENGTH_LONG).show(); }