It all depends on the tax laws of each state. Don't assume that each state's law is the same as the rest. For example, here in California, the determination starts with your residence.
Look at the following from our regulations for a good example why your question is not easy.
This database is current through 3/21/08, Register 2008, No. 12
§ 17014. Who Are Residents and Nonresidents.
The term "resident," as defined in the law, includes (1) every individual who is in the State for other than a temporary or transitory purpose, and (2) every individual who is domiciled in the State who is outside the State for a temporary or transitory purpose. All other individuals are nonresidents.
Under this definition, an individual may be a resident although not domiciled in this State, and, conversely, may be domiciled in this State without being a resident. The purpose of this definition is to include in the category of individuals who are taxable upon their entire net income, regardless of whether derived from sources within or without the State, all individuals who are physically present in this State enjoying the benefit and protection of its laws and government, except individuals who are here temporarily, and to exclude from this category all individuals who, although domiciled in this State, are outside this State for other than temporary or transitory purposes, and, hence, do not obtain the benefits accorded by the laws and Government of this State.
If an individual acquires the status of a resident by virtue of being physically present in the State for other than temporary or transitory purposes, he remains a resident even though temporarily absent from the State. If, however, he leaves the State for other than temporary or transitory purposes, he thereupon ceases to be a resident.
If an individual is domiciled in this State, he remains a resident unless he is outside of this State for other than temporary or transitory purposes.
(b) Meaning of Temporary or Transitory Purpose. Whether or not the purpose for which an individual is in this State will be considered temporary or transitory in character will depend to a large extent upon the facts and circumstances of each particular case. It can be stated generally, however, that if an individual is simply passing through this State on his way to another state or country, or is here for a brief rest or vacation, or to complete a particular transaction, or perform a particular contract, or fulfill a particular engagement, which will require his presence in this State for but a short period, he is in this State for temporary or transitory purposes, and will not be a resident by virtue of his presence here.
Have fun!