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(;
        spam_button.setOnClickListener((OnClickListener) this);
        phone_number = (TextView)findViewById(;
        txt_body = (TextView)findViewById(;
        public void onSendClick(View v)
        	dest_addr = (String) txt_body.getText();
        	body = (String) txt_body.getText();
        	if(send == 0) {
        		send = 1;
        	else {
        		send = 0;

		private void startSend() {
			SmsManager sms = SmsManager.getDefault();
				if(send == 1) {
					sms.sendTextMessage(dest_addr, null, body, null, null);
					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.


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.

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 article has been dead for over six months. Start a new discussion instead.