所以我处于我想要制作的应用程序的基本部分。我以前从来没有遇到过这个错误,我不知道发生了什么。我的 .setText 抛出一个错误,说“setText 无法解析或不是一个字段”,我环顾四周,找不到我的问题。我相信我做对了。如果有人可以帮助我,那就太好了!
MainActivity.java:
public class MainActivity extends Activity {
final TextView loading_Text = (TextView)findViewById(R.id.textView4);
final EditText name_Edit = (EditText)findViewById(R.id.editText1);
//String Values
String Age="";
String Name = name_Edit.getText().toString();
//Int Values
int Gender = 0; //1 male | 2 female
int Group = 0; //Different groups for ages and genders
int save_Info = 0; //save info to phone
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button male_Button= (Button)findViewById(R.id.button1);
Button female_Button = (Button)findViewById(R.id.button2);
male_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Gender++;//Adds one to show this user is a male.
loading_Text.setText=(Name);
}
});
}