package com.example.smssender;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class SmsActivity extends AppCompatActivity {
    public EditText etNum;
    public EditText etSms;
    public Button benvoi;


    @SuppressLint("WrongViewCast")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sms);

        etNum = (EditText)findViewById(R.id.etNum);
        etSms = (EditText)findViewById(R.id.etSms);
        benvoi = (Button) findViewById(R.id.benvoi);
        Envoyer();
    }


    private void  Envoyer(){
        benvoi.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                SmsManager.getDefault().sendTextMessage(etNum.getText().toString(),null,etSms.getText().toString(),null,null);


    }
});
    }}