我尝试使用以下代码将文字发送到电话号码。现在,我想在按钮点击时将屏幕截图发送到手机号码。
public class MainActivity extends AppCompatActivity {
Button send;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
send= (Button) findViewById(R.id.send);
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
smssend("03006110857","hi");
}
});
}
public void smssend(String phoneno,String msg){
try {
SmsManager smsManager=SmsManager.getDefault();
smsManager.sendTextMessage(phoneno,null,msg,null,null);
Toast.makeText(this, "msg send", Toast.LENGTH_SHORT).show();
}catch (Exception e)
{
Toast.makeText(this, e.getMessage().toString(), Toast.LENGTH_SHORT).show();
}
}