0

It compiles without any errors in Eclipse, and when I comment it out, the application does not crash, but somewhere in here it is making my application crash on startup. Does anyone know how to fix this problem?

Button send_button = (Button)findViewById(R.id.SendButton);
        spam_button.setOnClickListener((OnClickListener) this);
        phone_number = (TextView)findViewById(R.id.ph_num);
        txt_body = (TextView)findViewById(R.id.TextBody);
    }
        
        public void onSendClick(View v)
        {
        	dest_addr = (String) txt_body.getText();
        	body = (String) txt_body.getText();
        	
        	if(send == 0) {
        		send = 1;
        		startSend();
        		
        	}
        	else {
        		send = 0;
        	}
        
        }

		private void startSend() {
			SmsManager sms = SmsManager.getDefault();
				if(send == 1) {
					sms.sendTextMessage(dest_addr, null, body, null, null);
				}
				else
				{
					sms = null;
				}
			}
		}

Is it something wrong with my permissions in AndroidManifest? I added the "SMS_SEND" permission to it. That should be all I need. I am using the Android 2.1 target. Please let me know if there is anything I am doing wrong. Thanks for your help.

-fuggles

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by fuggles
0

Post the stack trace from the "crash". If you don't have one, put that your whole click handler block in a try-catch and print the stack trace in the catch block.

0

These are the only two things I can see that might interfere:

WARNING: Application does not specify an API level requirement!
Device API version is 7 (Android 2.1)

ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=fuggles.sms_sender/.SMS_sender_Main } If thats what you're looking for. Would it show up in the Console tab?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.