我在使用SQLite數據庫中的數據填充我的微調器時出現問題。以下是我的活動中的代碼。該活動崩潰無法啓動活動ComponentInfo錯誤,其中用箭頭指示。使用光標填充微調器的問題
public class ProjectsActivity extends Activity {
private ReelDbAdapter dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.projects_select);
fillProjectSpinner();
}
private void fillProjectSpinner(){
// initialize cursor to manage data binding to spinner
Cursor projectCursor = null;
Spinner spnExistingProjects = (Spinner)findViewById(R.id.spnExistingProject);
---> projectCursor = dbHelper.getExistingProjects();
//startManagingCursor(projectCursor);
/*
//get the list of project names from the database
String[] from = new String[] {dbHelper.clmProjectName};
//add a new item to the spinner for each of the rows in the database
int [] to = new int[]{R.id.txtViewProjectRow};
//initialize a cursor adapter (similar to ArrayAdapter when populating a spinner from a pre-defined array)
SimpleCursorAdapter projectAdapter = new SimpleCursorAdapter(this, R.layout.view_project_row, projectCursor, from, to);
//add all the rows to the spinner
spnExistingProjects.setAdapter(projectAdapter);
*/
}
下面是來自getExistingProjects方法的代碼從我將對DBAdapter 公共光標getExistingProjects(){
if(mDb == null)
{
this.open();
}
return mDb.query(dbTableProject, new String[] {clmProjectName, clmProjectShootingTitle, clmProjectJobNumber},
null, null, null, null, null);
}
什麼我可能是做錯了任何線索? TIA尋求幫助。 Norm
看起來不錯,我們需要堆棧跟蹤。 – Snicolas 2011-06-16 17:38:28