dbconnection = new SQLControlerSubject(this);
dbconnection.openDatabase();
spinnerM = (Spinner)findViewById(R.id.spinnerMark);
Cursor cursor = dbconnection.readSubjectMark();
String[] from = new String[] {
DBhelperSubject.SUBJECT_ID,
DBhelperSubject.SUBJECT_NAME
};
int[] to = new int[] {
R.id.subject_id,
R.id.spinnerMark
};
SimpleCursorAdapter adapterMark = new SimpleCursorAdapter
(MarkActivity.this, R.layout.support_simple_spinner_dropdown_item, cursor, from, to);
adapterMark.notifyDataSetChanged();
spinnerM.setAdapter(adapterMark);
readSubjectMark(){}
public Cursor readSubjectMark(){
String[] subjectNameOnly = new String[]{
DBhelperSubject.SUBJECT_ID,
DBhelperSubject.SUBJECT_NAME
};
Cursor c = database.query(DBhelperSubject.TABLE_SUBJECT,subjectNameOnly,null,null,null,null,null);
if (c !=null){
c.moveToFirst();
}
return c;
}
Why the spinner inside show nothing ?
It run without error but data won't go to the spinner itself.
Aucun commentaire:
Enregistrer un commentaire