It depends on what, exactly, you mean in this case.
Introducing yourself in the local language and politely asking to continue the conversation in English (or some other language that you may share with the person in question) is generally OK, and may even result in much more polite treatment by the locals, but at that point you should stick to English baring the particular cases I mention below.
Beyond that, the only times that code-switching seems to be reasonably universally acceptable when talking with strangers and lacking full fluency in both languages involved are meta-linguistic discussions (that is, discussing the language itself), using local place names (which will often also get you more polite responses), or when there is simply no proper translation for the intended concept in the language being spoke (this is part of how loanwords develop).
Code-switching to resolve ambiguity (for example, when the local language distinguishes between concepts that English does not distinguish between) may be considered acceptable, or may not be considered acceptable (when I’ve been traveling and actually done this, it’s seemed to be more acceptable among younger individuals).
Randomly peppering your speech with interjections from the local language though is generally not appreciated, and will usually reinforce that you’re a tourist (which is almost always a bad thing when traveling).