Android 微调器数据绑定问题。。
您好,我想将特定字段“位置”从我的表绑定到android中的微调器。这是我的密码。。有人能帮我吗Android 微调器数据绑定问题。。,android,Android,您好,我想将特定字段“位置”从我的表绑定到android中的微调器。这是我的密码。。有人能帮我吗 Cursor cur=db.getdata(); String[] columns=new String[]{DatabaseHandler.KEY_LOCATION}; int[] to=new int[] {R.id.text_location}; //ArrayAdapter<String> adapter=new ArrayAdapter<Strin
Cursor cur=db.getdata();
String[] columns=new String[]{DatabaseHandler.KEY_LOCATION};
int[] to=new int[] {R.id.text_location};
//ArrayAdapter<String> adapter=new ArrayAdapter<String>(Next.this,android.R.layout.simple_spinner_item);
SimpleCursorAdapter sc=new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,cur,columns,to,0);
sc.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(sc);
cursorcur=db.getdata();
字符串[]列=新字符串[]{DatabaseHandler.KEY_LOCATION};
int[]to=newint[]{R.id.text_location};
//ArrayAdapter=新的ArrayAdapter(Next.this,android.R.layout.simple\u微调器\u项);
SimpleCursorAdapter sc=新的SimpleCursorAdapter(这个,android.R.layout.simple\u微调器\u项,cur,columns,to,0);
sc.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
sp.setAdapter(sc);
试试这个
int[]to=newint[]{android.R.id.text1} 详细说明您的问题,以便用户能够理解您的需求。
Cursor cur=db.getdata();
String[] columns=new String[]{DatabaseHandler.KEY_LOCATION};
int[] to=new int[] {R.id.text_location};
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item,
cur,
columns,
new int[] { android.R.id.text1 });
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adapter );