Cannabis is legal in some states. In others, not so much. So if I am in a state where cannabis is legal, smoke it and walk across state line, without taking any with me, just in me, can I get arrested for smoking it in a place that was legal?
A state's criminal jurisdiction normally applies to acts committed in that state's territory. So if you consume something in state A, you can't be charged in state B for violating state B's prohibition against consuming that thing.
However, if state B has a prohibition against public intoxication, and you enter its territory while intoxicated, you could be charged for violating state B's prohibition on public intoxication.
The fact that you're crossing state lines also increases the possibility that the federal government would want to get involved; the location of the federal prosecution could be in either state, although neither state's court system would be involved.
It would depend on what the laws are in the state you entered. In CA there are laws about driving under the influence of marijuana, but you would be walking. There are laws about being under the influence in public, but someone would first have to notice it in your behavior and then think it necessary to report to law enforcement. There are also some exceptions for marijuana (for example if it's smoked at a party you are at you are not guilty of anything, but another series i or ii drug you may be). In CA if you drive under the influence of marijuana you are guilty of that crime even if you don't get stopped and charged with it. It would be the same in a state that prohibits marijuana. You'd be guilty of the crime. Would you be arrested? The answer to that question depends on other things.