构造一个输入页面的类,使用Bundle通过<key,value>传值(后期会改为MVVM-DataBinding形式)
public class ContentActivity extends AppCompatActivity implements View.OnClickListener { private EditText etUrl; private Button btnConvert; @Override protected void>super.onCreate(savedInstanceState); setContentView(R.layout.activity_content); initView(); } private void initView() { etUrl = (EditText) findViewById(R.id.et_url); btnConvert = (Button) findViewById(R.id.btn_convert); btnConvert.setOnClickListener(this); } @Override public void>switch (v.getId()) { case R.id.btn_convert: String str_url = "https://" + etUrl.getText().toString(); Bundle bundle = new Bundle(); bundle.putString("url", str_url); // 当输入框为空时,提示用户 if (str_url.equals("https://")) { Toast.makeText(getApplicationContext(), "输入框不能为空", Toast.LENGTH_SHORT).show(); } else