質問するログイン新規登録

質問編集履歴

1

三つのクラス記載しました。

2017/01/19 14:48

投稿

sakataiyahoo
sakataiyahoo

スコア8

title CHANGED
File without changes
body CHANGED
@@ -10,4 +10,70 @@
10
10
  いかようにすればできるのでしょうか。。。
11
11
  できれば画面Bで一度出力した値をもう一度処理して画面Cを返したです。
12
12
 
13
- よろしくお願いします。
13
+ よろしくお願いします。
14
+ Main.java
15
+ ```
16
+ @Override
17
+ protected void onCreate(Bundle savedInstanceState) {
18
+ super.onCreate(savedInstanceState);
19
+ setContentView(R.layout.activity_main);
20
+
21
+ tweeter = (Tweeter)this.getApplication();
22
+ editLength = (EditText)findViewById(R.id.edit_length);
23
+ editPlace = (EditText)findViewById(R.id.edit_place);
24
+
25
+ Button buttonMain = (Button) findViewById(R.id.button1);
26
+ buttonMain.setOnClickListener(new View.OnClickListener() {
27
+ @Override
28
+ public void onClick(View v) {
29
+ String length = editLength.getText().toString();
30
+ tweeter.setLength(length);
31
+ String place = editPlace.getText().toString();
32
+ tweeter.setPlace(place);
33
+
34
+ Intent intent = new Intent(getApplication(), SubActivity.class);
35
+ startActivity( intent );
36
+ }
37
+ });
38
+
39
+ }
40
+ ```
41
+
42
+ Sub
43
+ ```
44
+ protected void onCreate(Bundle savedInstanceState) {
45
+ super.onCreate(savedInstanceState);
46
+ setContentView(R.layout.activity_sub);
47
+
48
+ Tweeter tweeter = (Tweeter) this.getApplication();
49
+ String str = tweeter.getTweet();
50
+
51
+ TextView textViewSub = (TextView) findViewById(R.id.tweet);
52
+ textViewSub.setText(str);
53
+
54
+ Button buttonMain = (Button) findViewById(R.id.button2);
55
+ buttonMain.setOnClickListener(new View.OnClickListener() {
56
+
57
+ @Override
58
+ public void onClick(View v) {
59
+
60
+ Intent intent = new Intent(getApplication(), ResultActivity.class);
61
+ startActivity( intent );
62
+ }
63
+ });
64
+ }
65
+ ```
66
+
67
+ result
68
+ ```
69
+ protected void onCreate(Bundle savedInstanceState) {
70
+ super.onCreate(savedInstanceState);
71
+ setContentView(R.layout.result);
72
+
73
+ Tweeter tweeter = (Tweeter) this.getApplication();
74
+ String str = tweeter.getTweet();
75
+
76
+ TextView textViewSub = (TextView) findViewById(R.id.result);
77
+ textViewSub.setText(str);
78
+ }
79
+ ```