Using this rule, I can view the information in the database. I'm trying to put a button to get the latitude and longitude of the database so when you click it open google maps.
public class UsuarioAdapter extends ArrayAdapter<Usuario> {
private Context context;
private ArrayList<Usuario> lista;
public UsuarioAdapter(Context context, ArrayList<Usuario> lista){
super(context,0,lista);
this.context = context;
this.lista = lista;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final Usuario itemPosicao = this.lista.get(position);
convertView = LayoutInflater.from(this.context).inflate(R.layout.item_lista,null);
final View layout = convertView;
TextView textViewNome = (TextView) convertView.findViewById(R.id.textViewNome);
textViewNome.setText(itemPosicao.getNome());
TextView textViewCrm = (TextView) convertView.findViewById(R.id.textViewCrm);
textViewCrm.setText(itemPosicao.getCrm());
TextView textViewTelefone = (TextView) convertView.findViewById(R.id.textViewTelefone);
textViewTelefone.setText(itemPosicao.getTelefone());
TextView textViewConvenios = (TextView) convertView.findViewById(R.id.textViewConvenios);
textViewConvenios.setText(itemPosicao.getConvenios());
TextView textViewLatitude = (TextView) convertView.findViewById(R.id.textViewLatitude);
textViewLatitude.setText(itemPosicao.getLatitude());
TextView textViewLongitude = (TextView) convertView.findViewById(R.id.textViewLongitude);
textViewLongitude.setText(itemPosicao.getLongitude());
Button button = (Button)convertView.findViewById(R.id.buttonComoChegar);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
return convertView;
}
}
How can I do this?