I'm working on an app to help my local PokemonGO community and I'm having one last problem that I can't find the answer. I made a RecyclerView where I can add as many gyms as I want (this is working fine), and then, when the user clicks in that gym, I want the app to send to the location on Google Maps.
I created the following interface and the method on the adapter:
public interface OnItemClickListener {
void onItemClick(int position);
}
public void setOnItemClickListener(OnItemClickListener listener){
mListener = listener;
}
And this on the ViewHolder:
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (listener != null) {
int position = getAdapterPosition();
if (position != RecyclerView.NO_POSITION) {
listener.onItemClick(position);
}
}
}
});
And here is where I have the problem, that I don't know how to send the user to Maps
mAdapter.setOnItemClickListener(new GimnasioAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
String maps = gimnasiosLista.get(position).getURL();
}
});
Edit: The answer is here Launching Google Maps Directions via an intent on Android