我是Android Studio的新用户,这是我的问题,我使用了其他一些解决方案,但它们没用。我不知道那是什么问题。
代码如下,
public class SignUpActivity extends AppCompatActivity {
EditText etName;
EditText etEmail;
EditText etPass;
RadioButton radioButton1;
RadioButton radioButton2;
RadioGroup radioGroup;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
Button sgButton = findViewById(R.id.sgButton);
etEmail = findViewById(R.id.input_Email);
etPass = findViewById(R.id.input_password);
etName = findViewById(R.id.inputName);
radioButton1 = findViewById(R.id.f);
radioButton2 = findViewById(R.id.m);
radioGroup = findViewById(R.id.radioGroup);
sgButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
final String name = etName.getText().toString();
final String email = etEmail.getText().toString();
final String pass = etPass.getText().toString();
Toast toast = Toast.makeText(SignUpActivity.this,
"Crunch you felt it", Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER_HORIZONTAL,0,0);
toast.show(); // here is the Code for Toast.
}
}
);
}
}
任何帮助将不胜感激。