i try to work with spinner on dialog
public class data extends Dialog {
.
.
.
String[] iType = { "AA","BB","CC" };
public Spinner TypeSelect;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data);
setTitle("My Heder");
TypeSelect = (Spinner) findViewById(R.id.spinner2);
ArrayAdapter<String> TypeAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item,iType);
TypeSelect.setAdapter(TypeAdapter);
but i got error on this line:
ArrayAdapter<String> TypeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,iType);
the error:
The constructor ArrayAdapter<String>(data, int, String[]) is undefined
what can be the problem ?
Dialogisn’t a sub-class ofContextso you can’t usethisin the following…Try using
getContext()instead ofthis.