I am trying to create a text messaging application in android, the code works, but the only thing that is wrong is that I can not send messages to the emulator using DDMS. I pasted my code below, in case it is necessary, and I have a screenshot right after
package com.example.oghenekaroedoh.sms; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsMessage; import android.util.Log; import android.widget.Toast; public class SMSReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) {
Here is the code for the Activity, paste this code into another file.
package com.example.oghenekaroedoh.sms; import android.app.Activity; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class SMSActivity3 extends Activity { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI, deliveredPI; BroadcastReceiver smsSentReceiver, smsDeliveredReceiver; IntentFilter intentFilter; private BroadcastReceiver intentReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) {
Here's what the DDMS output looks like:
The main problem here is that the switches for telephony actions are not clickable. Someone please help me fix this.
source share