I have a screen where it has a Gridview
and a ImageButton
.
Well, by clicking on this ImageButton
I open a PopUp
that contains two spinner
and a ImageButton
.
These spinners
are populated through a web service that is called after the user logs in, so far so good.
When I select the information in the two spinners
and click on the button
, I can not retrieve the values (description or id) that I populated with my adapter
being that if I use the same code outside of a PopUp, the information but when I use it in a popup does not.
Follow the code on my adapter for my spinner
package br.com.projeto.adapter;
import java.util.ArrayList;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import br.com.projeto.entidade.DadosFiliais;
import br.com.projeto.entidade.DadosPortifolio;
import br.com.projeto.osportifolio.R;
public class SpinnerAdapter extends BaseAdapter {
private Context context;
ArrayList<DadosFiliais> data = new ArrayList<DadosFiliais>();
public SpinnerAdapter(Context context,ArrayList<DadosFiliais> data) {
this.context = context;
this.data = data;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
DadosFiliais datas = new DadosFiliais();
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(android.R.layout.simple_list_item_1, null);
TextView text1 = (TextView) view.findViewById(android.R.id.text1);
text1.setText(data.get(position).getDsFilial());
return view;
}
@Override
public int getCount() {
return 32;
}
@Override
public Object getItem(int position) {
return "TextView";
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate(R.layout.row_spinner, null);
TextView text1 = (TextView) view.findViewById(R.row_s.dados_spinner);
TextView text2 = (TextView) view.findViewById(R.row_s.dados_spinner_2);
text1.setText(data.get(position).getDsFilial());
text2.setText(data.get(position).getCdFilial());
return view;
}
}
Code used to pick up spinner values
String localidadeStr = txtLocalidade.getText().toString();
String movimentoStr = txtMovimento.getText().toString();
localidade = Integer.parseInt(localidadeStr);
movimento = Integer.parseInt(movimentoStr);
instead of bringing the value it retrieves the value "TextView"