调用系统自带的发短信Activity

实现功能:点击按钮进入系统自带的发短信界面

调用系统自带的发短信Activity
调用系统自带的发短信Activity
Activity.java

private 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" />


调用系统自带的发短信Activity

上一篇:HDU 4745 Two Rabbits(非连续最长回文子序列,区间DP)


下一篇:STL优先级队列(priority_queue)和集合(set)的使用