本文共 869 字,大约阅读时间需要 2 分钟。
系统功能-----调用短信发送功能
其他的系统功能有时间再写package com.example.myapplication2;
import android.app.Activity;
import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button;public class MainActivity extends Activity {
Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = findViewById(R.id.btn); btn.setOnClickListener(new mClick()); }private class mClick implements View.OnClickListener { public void onClick(View v){ Uri uri = Uri.parse("smsto:123456789"); Intent it = new Intent(Intent.ACTION_SENDTO,uri); it.putExtra("body","tet"); startActivity(it); }}
}
转载地址:http://bkegn.baihongyu.com/