实现功能:点击按钮进入系统自带的发短信界面
Activity.javaprivate Button ButtonThree;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_third);
ButtonThree=(Button) findViewById(R.id.button3);
//ButtonThree.setText("");
ButtonThree.setOnClickListener(new ButtonThreeListener());
}
class ButtonThreeListener implements OnClickListener{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Uri uri=Uri.parse("smsto://0800000123");
Intent it= new Intent(Intent.ACTION_SENDTO,uri);
it.putExtra("sms_body","The SMS text");
startActivity(it);
}
}
AndroidManifest.xml
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.SEND_SMS" />