Hamlet's soliloquy characterizes him differently depending on what you think his motivation is for delivering it. If you believe that Hamlet KNOWS that Claudius and Polonius are eavesdropping, then it could be argued that Hamlet (if he is feigning madness) is feeding them lines about his contemplation of suicide.
Or, it could also be argued that when he is talking about "action" he is talking about killing Claudius and wants to make Claudius worry that he is on to him ...
If you believe that Hamlet thinks he is alone, then you might interpret this soliloquy as providing insight into the inner workings of Hamlet's brain. "To be or not to be, that is the question ... whether tis nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles, and by opposing, end them." In other words, he is thinking, "Should I live or die? Am I more noble if I suffer all the torments that life throws at me, or am I better off taking up arms (weapons) against the troubles that life throws at me, and killing myself?"
A lot depends on how you read the soliloquy. (If you've seen different film versions of this soliloquy, you'll see that different directors interpret it very differently. Check out Gibson, Branagh, and Olivier on YouTube, if you can)!