I'm in doubt how to put a spinner in an AlertDialog, I already have the codes ready, just need to insert the spinner.
Array:
<string-array name="categoria_array">
<item>Aeroporto</item>
<item>Bar</item>
<item>Casa Noturna</item>
<item>Cinema</item>
<item>Colégio</item>
<item>Loja</item>
<item>Museu</item>
<item>Parque</item>
<item>Restaurante</item>
<item>Rodoviárias</item>
<item>Shoppings</item>
<item>Supermercado</item>
<item>Teatro</item>
<item>Universidade</item>
<item>Outro</item>
</string-array>
Layout:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/titulo"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/colorPrimary"
android:gravity="center"
android:text="NOVA LOCALIZAÇÃO"
android:textColor="@color/colorWhite"
android:textSize="20sp"
android:textStyle="bold"
/>
<EditText
android:id="@+id/edt_nome"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/titulo"
android:layout_margin="15dp"
android:background="@drawable/border_transp_black_redond"
android:hint=" Nome do Local"
android:padding="5dp"
android:textColorHint="@color/colorPrimaryText"
android:textSize="20sp"
android:textStyle="italic" />
<EditText
android:id="@+id/edt_endereco"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/edt_nome"
android:layout_margin="15dp"
android:background="@drawable/border_transp_black_redond"
android:hint=" Endereço"
android:padding="5dp"
android:textColorHint="@color/colorPrimaryText"
android:textSize="20sp"
android:textStyle="italic" />
<EditText
android:id="@+id/edt_website"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/edt_endereco"
android:layout_margin="15dp"
android:hint=" WebSite"
android:padding="5dp"
android:inputType="textWebEditText"
android:textStyle="italic"
android:textColorHint="@color/colorPrimaryText"
android:textSize="20sp"
android:background="@drawable/border_transp_black_redond"/>
<EditText
android:id="@+id/edt_telefone"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/edt_website"
android:layout_margin="15dp"
android:hint=" Telefone"
android:padding="5dp"
android:inputType="number"
android:textStyle="italic"
android:textColorHint="@color/colorPrimaryText"
android:textSize="20sp"
android:background="@drawable/border_transp_black_redond"/>
<Spinner
android:id="@+id/spinner_catogorias"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edt_telefone"/>
</RelativeLayout>
AlertDialog Method:
private void chamarDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
builder.setView(inflater.inflate(R.layout.layout_newcheckin, null));
//Dialog dialog = builder.show();
//dialog.dismiss(); fecha o dialog
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(), "Cliked OK!", Toast.LENGTH_SHORT);
return;
}
});
builder.show();
}