1
Using this rule I can view the database information. I want to put a button to get the latitude and longitude of the database for when click on 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?
What is your difficulty? Fetch this data from the BD, open Google Maps or both?
– ramaral
both, wanted to open the button searching the latitude and longitude data that are in the table of the flock (table = longitute) and (table = latutide) and opening the (app) of google maps.
– Mauro Santos
Where you are retrieving data regarding "Name", "Crm", "Telephone", etc?
– ramaral
from my local postgresql database
– Mauro Santos
Then why not also include latitude and longitude in the array that passes to the Adapter?
– ramaral