Android SmsManager freezes when I use SendTextMessage function
<p>My Android app freezes when I send the function "SendTextMessage". My code looks like this:</p>

<pre><code>    public void doIt(View target) {
    ProgressBar pb1 = (ProgressBar)findViewById(R.id.progressBar1);
    TextView tv1 = (TextView)findViewById(R.id.textView3);
    pb1.setVisibility(View.VISIBLE);
    tv1.setVisibility(View.VISIBLE);
    tv1.setText("Sending Text...");
    SmsManager sm = SmsManager.getDefault();
    sm.sendTextMessage("#########(censoreD)", null, "lol", null, null);
    tv1.setText("Message Sent.");
}
</code></pre>

<p>How can I fix this? Nothing is wrong with my main.xml:</p>

<pre><code>&lt;Button android:onClick="doIt" android:layout_width="200sp" android:id="@+id/button1" android:layout_height="wrap_content" android:text="Send Messages" android:layout_x="62dip" android:layout_y="189dip"&gt;&lt;/Button&gt;
</code></pre>

<p>thanks.</p>
