Mein Spinner zeigt zwar die WerteListe als DropDown an aber weder werden die Werte in den Textteil geschreiben noch wird der Listener OnSelectedItem funktioniert nicht mehr.
Ich bekomme keine Fehler, und habe keine Ahnung wo ich das anfassen soll !
Ich bekomme keine Fehler, und habe keine Ahnung wo ich das anfassen soll !
Code:
public ArrayList<A2100_spin_groups_fields> a2100_spin_groups_array = new ArrayList<A2100_spin_groups_fields>();
A2100_spin_groups_fields_adapter spinGroupAdapter;
TextView TFIDMember;
EditText TFMemberName;
CheckBox CBMemberAktiv;
Spinner SPMemberGroup;
String MemberID;
String MemberName;
String MemberAktiv;
String MemberGroup;
@Override
protected void onCreate(Bundle savedInstanceState) {
boolean varAktiv;
super.onCreate(savedInstanceState);
setContentView(R.layout.a2100_member_change);
String method = "SPI";
A2100_member_change.BGT2100 BGT2100 = new A2100_member_change.BGT2100(this);
BGT2100.execute(method, MemberID, MemberName, MemberAktiv, MemberGroup);
// Resources passed to adapter to get image
Resources res = getResources();
TFIDMember = (TextView) findViewById(R.id.A2100_IDMember);
TFMemberName = (EditText) findViewById(R.id.A2100_MemberName);
CBMemberAktiv = (CheckBox) findViewById(R.id.A2100_MemberAktiv);
SPMemberGroup = (Spinner) findViewById(R.id.A2100_MemberGroup);
// Create custom adapter object ( see below CustomAdapter.java )
spinGroupAdapter = new A2100_spin_groups_fields_adapter(this, R.layout.a2100_spin_groups_rowlayout, a2100_spin_groups_array,res);
// Set adapter to spinner
SPMemberGroup.setAdapter(spinGroupAdapter);
String[] TagToChange = getIntent().getExtras().getString("TagToChange").split(";");
if(TagToChange[2].equals("0")) {varAktiv = false;} else {varAktiv = true;}
if (TagToChange[0].equals("0"))
{
TFIDMember.setText(null);
TFMemberName.setText(null);
CBMemberAktiv.setChecked(false);
SPMemberGroup.setSelection(0);
} else
{
TFIDMember.setText(TagToChange[0]);
TFMemberName.setText(TagToChange[1]);
CBMemberAktiv.setChecked(varAktiv);
SPMemberGroup.setSelection(0);
}
// Listener called when spinner item selected
SPMemberGroup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentview, View v, int position, long id) {
// Get selected row data to show on screen
String GroupID = ((TextView) v.findViewById(R.id.a2100spinGrp_GroupID)).getText().toString();
String GroupName = ((TextView) v.findViewById(R.id.a2100spinGrp_GroupName)).getText().toString();
String OutputMsg = "Selected Group : \n\n"+GroupID+"\n"+GroupName;
System.out.println("Group : " + GroupID);
Toast.makeText(getApplicationContext(),OutputMsg, Toast.LENGTH_LONG).show();
}
@Override
public void onNothingSelected(AdapterView<?> parentView) {
System.out.println("bin dada ");
}
});
}