Currently, when the ListItem is clicked I grab its position and pass it to my StopsScheduleActiviy. I would like to detect when the ImageView of that ListItem is clicked so that I can launch my MapActivity instead and pass it the position.
Basically: Click the ImageView launch MapsActivity, otherwise click anywhere else on ListItem launch StopsScheduleActivity. In Both cases I need the position. How can I do this?
Here is my current onItemClick listener.
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent myIntent = new Intent(this, StopsScheduleActivity.class);
myIntent.putExtra("stop", stops.get(position));
startActivity(myIntent);
Log.i("Winnipeg Bus", "Stop item #" + id + " clicked.");
}
Here is my ListView with a map for an ImageView that I want to listen to for clicks. Thanks!
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
...Actually, in hindsight the click did register... – AdorlmyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
worked. Thanks! Post an answer below detailing what you told me and I'll accept. Thanks again. – Adorl