I have three spinner
with same custom SimpleCurosAdapter
spinnerX = (Spinner)findViewById(R.id.spinnerX);
spinnerY = (Spinner)findViewById(R.id.spinnerY);
spinnerZ = (Spinner)findViewById(R.id.spinnerZ);
spinnerX.setAdapter(new SpinnerAd(this, R.layout.my_item, c, from, to));
spinnerY.setAdapter(new SpinnerAd(this, R.layout.my_item, c, from, to));
spinnerZ.setAdapter(new SpinnerAd(this, R.layout.my_item, c, from, to));
And when i call (for example):
spinnerX.setSelection(1);
spinnerY.setSelection(7);
spinnerZ.setSelection(3);
ALL three spinners setSelection
like last one... at position 3
.
Why?
All spinners has same data (one cursor)
Problem solved, but i do not understand why does it matter, becouse
c == dbRead.query(CalcDBHelper.TABLE_VARIABLES, null, null, null, null, null, null);
Solution, set adapter like this:
spinnerX.setAdapter(new SpinnerAd(this, R.layout.formula_variable_item, ActMain.dbRead.query(CalcDBHelper.TABLE_VARIABLES, null, null, null, null, null, null), from, to));
spinnerY.setAdapter(new SpinnerAd(this, R.layout.formula_variable_item, ActMain.dbRead.query(CalcDBHelper.TABLE_VARIABLES, null, null, null, null, null, null), from, to));
spinnerZ.setAdapter(new SpinnerAd(this, R.layout.formula_variable_item, ActMain.dbRead.query(CalcDBHelper.TABLE_VARIABLES, null, null, null, null, null, null), from, to));