private Integer flag4 = 0 , flag5 = 0 , flag6 = 0 , flag7 = 0, flag8 = 0, flag9 = 0 , flag10 = 0, flag11 = 0, flag12 = 0;
private Integer counter1 = 0 , counter2 = 0;
EditText tex = (EditText) findViewById(R.id.editText3);
@Override
protected void onCreate(Bundle savedInstanceState) {
// setContentView(R.layout.activity_startwith2player);
System.out.println("yes yes");
// StartByPlayerOne();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_startwith2player);
// StartByPlayerOne();
// prrrint();
// Bundle extras = getIntent().getExtras();
// Integer latLong = extras.getInt("NameOfPlayer1");
// TextView player = (TextView)findViewById(R.id.textView3);
// player.setText("" + latLong);
// System.out.println(latLong);
}
我想用tex.SetText(字符串),但在此之前,我得到的NullPointerException從第3線路:( 任何想法 安卓?!?!的onClick = 「button12」/>爲什麼我從EditText android得到NullPointerException?
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="score1"
android:id="@+id/textView3"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText3"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button4"
android:layout_toEndOf="@+id/button4"
android:text="AA" />
這就是我的XML代碼
你能分享你的佈局文件? – TechnoBlahble
是的,我分享 –