问题描述
|
发送功能\“ SendTextMessage \”时,我的Android应用程序冻结。我的代码如下所示:
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);
tv1.setText(\"Message Sent.\");
}
我怎样才能解决这个问题?我的main.xml没有任何问题:
<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\"></Button>
谢谢。
解决方法
我会猜测并说您没有正确的权限。
android.permission.SEND_SMS
所有可用权限:http://developer.android.com/reference/android/Manifest.permission.html