hi guys,
i have a application which send sms. but i found that the application
always sends 2 sms messages to the selected number.
couldn't figure out how is this happening. so i'll paste the code
below if you have any suggestions just let me know
public class Compose extends Activity {
private EditText name, msg;
private Button send;
private Spinner spinnerTimer;
private ImageButton contacts;
String contactName, number;
private ImageView shp;
private HashMap<String, Integer> color;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.compose_sms);
colorMap();
name = (EditText) findViewById(R.id.num);
msg = (EditText) findViewById(R.id.msg);
send = (Button) findViewById(R.id.snd);
send.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d("Button", "Button");
send("454546", "Mike");
return;
}
});
}
public void alert(String header, String body) {
new AlertDialog.Builder(this).setTitle(header).setMessage(body)
.setCancelable(true).setNeutralButton("Close",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
}
}).show();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
Intent intent = new Intent(this, Menu.class);
startActivityForResult(intent, 107);
return true;
}
return false;
}
private void send(String number,String msg) {
PendingIntent pi = PendingIntent.getActivity(this, 0,
new Intent(this, Compose.class), 0);
Log.d("SMS", "SMS");
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(number, null, msg, pi,
null);
}
}
regards,
Mike
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en