It depends on the state. In some states, you must live there for six months before you are legally a resident. In others, you are instantly a resident when you move there.
Of course, for the purposes of buying a gun, by federal law, all that is required is INTENT to become a resident. How an individual state or FFL handles that is something else, though.
A state ID is exactly the same as a state-issued driver's license for the purposes of buying a gun; you don't have to be able to drive a car to buy a gun.
If it were ever to come up in court, you would probably need to be renting/owning a place full-time in that state in order to be considered a resident. Two-weeks per year in a time-share probably wouldn't be enough, but renting a room 12 months a year from someone should be fine. You'd want a contract, etc. And some states require you to LIVE in the state more than 6 months a year to be considered a resident, so that could be a problem. You can be sure your employment records, bills, car registration, etc., would be checked.
Try posting some specific examples in the Legal forum.
-Troy