回答編集履歴
1
コード中のコメント修正
answer
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
Log.d(TAG, "MainActivity1.count:" + count);
|
28
28
|
Button button1 = (Button)findViewById(R.id.button1);
|
29
29
|
|
30
|
-
// ボタンのテキストに現在のcount値をセット
|
30
|
+
// ボタンのテキストに現在のcount値をセット。
|
31
31
|
button1.setText(String.format("MAIN1: %d", count));
|
32
32
|
button1.setOnClickListener(buttonClick);
|
33
33
|
}
|
@@ -35,7 +35,7 @@
|
|
35
35
|
private View.OnClickListener buttonClick = new View.OnClickListener() {
|
36
36
|
@Override
|
37
37
|
public void onClick(View view) {
|
38
|
-
// 次の画面を開く為のインテント。現在値
|
38
|
+
// 次の画面を開く為のインテント。次の画面への値としてcountの現在値 + 1を入れておく。
|
39
39
|
Intent intent = new Intent(getApplicationContext(), MainActivity2.class);
|
40
40
|
intent.putExtra("IntValue", count + 1);
|
41
41
|
|