Aqui está o xml:
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinner"
android:background="#ffffff"
android:layout_above="@+id/endereco"
android:spinnerMode="dialog"
android:visibility="visible"
android:theme="@style/Animation.AppCompat.DropDownUp" />
E a classe do formulário:
public class Reclame extends Cronograma implements AdapterView.OnItemSelectedListener{
Spinner option;
Button btnSend;
EditText Nome;
EditText Message;
EditText Endereco;
EditText Telefone;
EditText Email;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.reclame, container, false);
Nome = (EditText) view.findViewById(R.id.nome1);
Message = (EditText) view.findViewById(R.id.msg);
Endereco = (EditText) view.findViewById(R.id.endereco);
Telefone = (EditText) view.findViewById(R.id.telefone);
Email = (EditText) view.findViewById(R.id.email);
btnSend = (Button) view.findViewById(R.id.send);
option = (Spinner)view.findViewById(R.id.spinner);
option.setOnItemSelectedListener(this);
ArrayAdapter adapter = ArrayAdapter.createFromResource(getActivity(), R.array.option, android.R.layout.simple_spinner_item);
option.setAdapter(adapter);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String nome = Nome.getText().toString();
String message = Message.getText().toString();
String matricula = Endereco.getText().toString();
String telefone = Telefone.getText().toString();
String assunto = option.getSelectedItem().toString();
String ema = Email.getText().toString();
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
email.putExtra(Intent.EXTRA_SUBJECT, assunto);
email.putExtra(Intent.EXTRA_TEXT, "Nome: " +nome +'\n'+ "Endereço: "+matricula + '\n'+ "Telefone: "+telefone + '\n'+ "E-mail: "+ema + '\n'+ '\n'+message);
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Selecione o serviço de e-mail:"));
}
});
return view;
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
TextView mtext = (TextView) view;
//Toast.makeText(getActivity(), "Você selecionou: "+mtext.getText(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
Como faço pra corrigir este problema?