I am trying to put a spinner in a dialog window but it is doesn't work . the compilation work but when i open the dialog window the app stop to work .
@Override
public void onClick(View view) {
s=(Spinner) findViewById(R.id.spinnerdevise);
AddDialog d = new AddDialog(MainActivity.this) ;
d.setContentView(R.layout.dialogedit);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(d.a,
R.array.devise_spin, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s.setAdapter(adapter);
d.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
d.show();
}
xml of the dialog: dialogedit.xml
...
<Spinner
android:id="@+id/spinnerdevise"
android:layout_width="45dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
...
String.xml
<string-array name="devise_spin">
<item>azd</item>
<item>zdad</item>
<item>sdsfqf</item>
<item>dadf</item>
<item>adasd</item>
</string-array>
thanks for help