我正在从我的 sqlitedatabase 中检索字符串数据并与我的本地变量进行比较。但它不起作用。它就像下面的代码。
String hole1 = " ";
Cursor cc = save.rawQuery("Select *from " +data + " where Mobile = '"+ number +"'", null);
cc.moveToFirst();
hole1 = cc.getString(cc.getColumnIndex("Hole1"));
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(
this,
R.layout.spinnerlayout,
new String[] { hole1,"1", "2", "3", "4","5","6","7","8","9" }); adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
((Spinner) findViewById(R.id.soloscorehole1front9)).setAdapter(adapter1);
if( ((Spinner) findViewById(R.id.soloscorehole1front9)).getSelectedItem().toString() == hole1){
Toast.makeText(Activity.this,"True!", Toast.LENGTH_LONG).show();
}
谁能指出这个简单的代码有什么问题?