All in is for 2 things.. #1 If you do find yourself short-stacked, then you're going to have to pick an opportune moment to put all of your chips at risk, probably several times, in order to rebuild a viable position; otherwise, the blinds will just eat your stack up. If you find yourself in this situation, try to put all of your chips in with a starting hand that's at least a pair, or contains an Ace or King, or a suited hand - in order to give yourself the most outs.
#2Also, don't call an all-in bet heads-up unless you have a real hand, since it's likely that your opponent also has a very strong hand and is deliberately trying to pull you in.
It's best to have a good hand and to be the one calling the other player all-in, if possible.
Notice the part about a REAL hand it is is best to have a good hand and to the bhe one calling the other player all-in if possible. Not to mention they are deliberatly trying to pull you all-in.