I'm trying to display spinners values in popup box when button clicks. But the spinner values are not showing in popup window. This is the code in Attach Activity - Button click event:
btnimage.setOnClickListener(v->{
View view = LayoutInflater.from(Attach.this).inflate(R.layout.activity_attach_form,null);
AlertDialog.Builder builder = new AlertDialog.Builder(Attach.this);
builder.setView(view);
AlertDialog alertDialog = builder.create();
alertDialog.show();
});
In My attach form activity, am trying to show the spinner values.
Spinner spindoc;
String[] doc = {"select", "doc1", "doc2", "doc3"};
spindoc = findViewById(R.id.spindoc);
spindoc.setOnItemSelectedListener(this);
ArrayAdapter adapter1 = new ArrayAdapter(this, android.R.layout.simple_spinner_item,doc);
adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spindoc.setAdapter(adapter1);
Respective XML files:
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spindoc"
android:layout_marginTop="-20dp"
android:textColor="#000000"
android:layout_weight="1"
/>
Please let me know if I missed any syntax, while displaying spinners in popup. Because in normal view, the above code is working fine...