Pro21Activity.java
package ps.pro21;
import android.app.Activity;
import android.os.Bundle;
import android.telephony.gsm.SmsManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class Pro21Activity extends Activity implements OnClickListener {
/**
* www.master-gtu.blogspot.com
* pankaj sharma(8460479175),
* chavda vijay(8460420769)
*/
EditText ednumber, edmsg;
Button btsend;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ednumber=(EditText) findViewById(R.id.editTextnumber);
edmsg=(EditText) findViewById(R.id.EditTextmsg);
btsend=(Button) findViewById(R.id.buttonsend);
btsend.setOnClickListener(this);
}
private void sendsms(String num,String msg)
{
SmsManager sms=SmsManager.getDefault();
sms.sendTextMessage(num, null, msg, null, null);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
sendsms(ednumber.getText().toString(),edmsg.getText().toString());;
}
}
No comments:
Post a Comment