1.获取用户名
package com.example.myapplication; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; public class MyApplication extends AppCompatActivity { private EditText st; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn=findViewById(R.id.button2); st= findViewById(R.id.editText3); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String text=st.getText().toString(); Log.e("leo","内容"+text); } }); } }
标签:Log,androidx,安卓,st,开发,import,android,View From: https://www.cnblogs.com/msdn/p/16950204.html