'On' or 'in' when walking (or running, or anything similar) depends on the sort of thing being walked through, over or within. For example, you would:
walk in the rain
walk in the street
walk in the park
...but...
walk on the path
walk on the pavement
walk on the grass
you could also:
walk on the left-hand side (but here what you're walking on is implied, like on an escalator)
So 'in' would be used when the thing being walked through sort of surrounds the walker, whereas 'on' is used when the thing is more physically under your feet. As the other comment noted, you can be 'in' a place like 'London' and 'in' a place like 'town', as they sort-of surround you, whereas you'd be 'on' London Bridge.
However, some things could be walked 'in' and 'on' - such as a street. If you want to suggest that it's actually the thing under your feet, then use 'on', but if you want to refer to the street as something like the shops and the people, etc. and wish to represent that you're immersed in it, then you would 'have a walk in the street' instead.