android studio phone text messaging into value-passing between web activity

package com.dingcheng365.yzgk89.h01;

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;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity
{
    // 变量 *********************************************************************
    private TextView tvMsg = null;
    private Button btnOpenA01 = null;
    private Button btnCall = null;
    private EditText etTel = null;
    private Button btnSms = null;
    private EditText etSms = null;
    private Button btnUrl = null;
    private EditText etUrl = null;

    // 函数 *********************************************************************
    public void OpenA01_clik(View v){
        // 获取数据
        String strTel = "";
        String strSms = "";

        strTel = etTel.getText().toString();
        strSms = etSms.getText().toString();

        // 将数据赋值给intent
        Intent intent = new Intent(MainActivity.this,A01Activity.class);
        intent.putExtra("Tel",strTel);
        intent.putExtra("Sms",strSms);

        // 启动Activity
        startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Initialize the object 
        tvMsg = (the TextView) the findViewById (R.id.tvMainMsg); 
        btnOpenA01 = (the Button) the findViewById (R.id.btnMainOpenA01); 
        btnCall = (the Button) the findViewById (R.id.btnMainCall); 
        etTel = (the EditText) the findViewById (R.id.etMainTel); 
        btnSms = (the Button) the findViewById (R.id.btnMainSms); 
        etSms = (the EditText) the findViewById (R.id.etMainSms); 
        btnUrl = (the Button) the findViewById (R.id.btnMainUrl); 
        etUrl = (the EditText) findViewById (R.id.etMainUrl); 

        // call button click event 
        btnCall.setOnClickListener ( new new View.OnClickListener () 
        { 
            @Override 
            public  void onClick (View v) 
            { 
                // get the phone number 
                String strTel = "" ; 

                strTel = etTel.getText () toString ();. 

                // call to fight calls the App 
                Uri URI = Uri.parse ( " Tel: " + strTel); 
                the Intent Intent = new new the Intent (Intent.ACTION_DIAL, URI); 
                startActivity (Intent); 

            } 
        }); 

        // send SMS button click event
        btnSms.setOnClickListener ( new new View.OnClickListener () 
        { 
            @Override 
            public  void the onClick (View V) 
            { 
                // Get the telephone number 
                String strTel = "" ; 
                strTel = etTel.getText () toString ();. 

                // Get send SMS content 
                strSms = String "" ; 
                strSms = . etSms.getText () toString (); 

                // start App Android phones to send text messages in the Activity 
                uri uri = Uri.parse ( " smsto: " strTel);+
                The Intent the Intent = new new the Intent (Intent.ACTION_SENDTO, uri); 
                intent.putExtra ( " SMS_BODY " , strSms); 
                startActivity (the Intent); 
            } 
        }); 

        // open the page button click event 
        btnUrl.setOnClickListener ( new new View.OnClickListener ( ) 
        { 
            @Override 
            public  void the onClick (View V) 
            { 
                // get the URL 
                String strUrl = "" ; 
                strUrl = etUrl.getText () toString ();.

                //Page starting opening the App 
                Uri URI = Uri.parse (strUrl); 
                the Intent Intent   = new new the Intent (Intent.ACTION_VIEW, URI); 
                startActivity (Intent); 
            } 
        }); 


    } 





}

Accepted value

super.onCreate (savedInstanceState); 
        the setContentView (R.layout.activity_a01); 

        // initialize objects 
        btnBack = (the Button) the findViewById (R.id.btnA01Back); 
        tvMsg = (the TextView) the findViewById (R.id.tvA01Msg); 

        // Get the Intent 
        the Intent Intent = null ; 
        Intent = its getIntent (); 

        // get specific data 
        String strTel = "" ; 
        String strSms = "" ; 

        strTel = intent.getStringExtra ( " Tel " ); 
        strSmsIntent.getStringExtra = ( " Sms " ); 

        // echo data 
        tvMsg.setText ( " Tel: " + strTel + " Sms: " + strSms); 

        // define the back button's click event 
        btnBack.setOnClickListener ( new new View .OnClickListener () 
        { 
            // click event function corresponding 
            @Override
             public  void the onClick (View V) 
            { 
                Finish (); 
            } 
        });

 

Guess you like

Origin www.cnblogs.com/zlj843767688/p/12565131.html