Código Java:
Ver original
package juan.pruebas.smssender; import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.Toast; public class GNOCAccesSmsSenderActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final CheckBox checkBox = (CheckBox)findViewById(R.id.checkBoxEntradaSalida); EditText numCaso = (EditText)findViewById(R.id.numCaso); EditText emplazamiento = (EditText)findViewById(R.id.emplazamiento); EditText nomTec = (EditText)findViewById(R.id.nomTec); EditText empresa = (EditText)findViewById(R.id.empresa); EditText trabRealizar = (EditText)findViewById(R.id.trabRealizar); if (checkBox.isChecked()){ checkBox.setChecked(false); } checkBox.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub if (checkBox.isChecked()){ checkBox.setText("Entrada"); entradaSalida = "INI."; } else { checkBox.setText("Salida"); entradaSalida = "FIN."; } } }); + "." + var_nomTec + "." + var_empresa + ".LOC:IN-" + var_trabRealizar; final SmsManager enviarSms = SmsManager.getDefault(); final PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT), 0); final PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0); // TODO Auto-generated method stub //enviarSms.sendTextMessage(telefonoGnoc, null, sms, sentPI, deliveredPI); Toast.makeText(getApplicationContext(), sms, Toast.LENGTH_LONG).show(); } }); } }