質問編集履歴

1

ご指摘の箇所を追記致しました。

2017/12/14 12:57

投稿

68kjo_pzdr
68kjo_pzdr

スコア8

test CHANGED
File without changes
test CHANGED
@@ -40,7 +40,243 @@
40
40
 
41
41
  ```
42
42
 
43
-
43
+ ###ソースコード
44
+
45
+ <追記>画面遷移後に出したいものです。
46
+
47
+ ```
48
+
49
+ <?xml version="1.0" encoding="utf-8"?>
50
+
51
+ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
52
+
53
+ xmlns:tools="http://schemas.android.com/tools"
54
+
55
+ android:layout_width="match_parent"
56
+
57
+ android:layout_height="match_parent"
58
+
59
+ tools:context="com.example.kajio.twotouchmail.PickUpActivity">
60
+
61
+
62
+
63
+ <TextView android:text="@string/subject"
64
+
65
+ android:layout_width="wrap_content"
66
+
67
+ android:layout_height="wrap_content"
68
+
69
+ android:textSize="18sp"
70
+
71
+ android:id="@+id/textView"/>
72
+
73
+
74
+
75
+ <EditText
76
+
77
+ android:layout_width="match_parent"
78
+
79
+ android:layout_height="wrap_content"
80
+
81
+ android:id="@+id/editText"
82
+
83
+ android:layout_below="@+id/textView"
84
+
85
+ android:layout_alignParentLeft="true"
86
+
87
+ android:layout_alignParentStart="true"
88
+
89
+ android:text="@string/button_pickup"/>
90
+
91
+
92
+
93
+ <TextView
94
+
95
+ android:layout_width="wrap_content"
96
+
97
+ android:layout_height="wrap_content"
98
+
99
+ android:textAppearance="?android:attr/textAppearanceMedium"
100
+
101
+ android:text="@string/place"
102
+
103
+ android:id="@+id/textView3"
104
+
105
+ android:layout_below="@+id/editText"
106
+
107
+ android:layout_alignParentLeft="true"
108
+
109
+ android:layout_alignParentStart="true"
110
+
111
+ android:layout_marginTop="16dp" />
112
+
113
+
114
+
115
+ <RadioGroup
116
+
117
+ android:layout_width="fill_parent"
118
+
119
+ android:layout_height="wrap_content"
120
+
121
+ android:id="@+id/rg_place"
122
+
123
+ android:layout_below="@+id/textView3"
124
+
125
+ android:layout_alignParentLeft="true"
126
+
127
+ android:layout_alignParentStart="true">
128
+
129
+
130
+
131
+ <RadioButton
132
+
133
+ android:layout_width="wrap_content"
134
+
135
+ android:layout_height="wrap_content"
136
+
137
+ android:text="@string/station"
138
+
139
+ android:id="@+id/radioButton1"
140
+
141
+ android:checked="true"/>
142
+
143
+ <RadioButton
144
+
145
+ android:layout_width="wrap_content"
146
+
147
+ android:layout_height="wrap_content"
148
+
149
+ android:text="@string/school"
150
+
151
+ android:id="@+id/radioButton2" />
152
+
153
+ <RadioButton
154
+
155
+ android:layout_width="wrap_content"
156
+
157
+ android:layout_height="wrap_content"
158
+
159
+ android:text="@string/always"
160
+
161
+ android:id="@+id/radioButton3" />
162
+
163
+
164
+
165
+ </RadioGroup>
166
+
167
+
168
+
169
+ <Button
170
+
171
+ android:layout_width="wrap_content"
172
+
173
+ android:layout_height="wrap_content"
174
+
175
+ android:text="@string/button_send"
176
+
177
+ android:id="@+id/button"
178
+
179
+ android:layout_below="@+id/rg_place"
180
+
181
+ android:layout_centerHorizontal="true"/>
182
+
183
+
184
+
185
+
186
+
187
+ </RelativeLayout>
188
+
189
+ ```
190
+
191
+
192
+
193
+ ```
194
+
195
+ package com.example.kajio.twotouchmail;
196
+
197
+
198
+
199
+ import android.content.Intent;
200
+
201
+ import android.content.res.Resources;
202
+
203
+ import android.net.Uri;
204
+
205
+ import android.os.Debug;
206
+
207
+ import android.support.v7.app.AppCompatActivity;
208
+
209
+ import android.os.Bundle;
210
+
211
+ import android.util.Log;
212
+
213
+ import android.view.View;
214
+
215
+ import android.widget.Button;
216
+
217
+ import android.widget.EditText;
218
+
219
+ import android.widget.RadioButton;
220
+
221
+ import android.widget.RadioGroup;
222
+
223
+
224
+
225
+ public class PickUpActivity extends AppCompatActivity {
226
+
227
+
228
+
229
+ @Override
230
+
231
+ protected void onCreate(Bundle savedInstanceState) {
232
+
233
+ super.onCreate(savedInstanceState);
234
+
235
+ setContentView(R.layout.activity_pick_up);
236
+
237
+ Button btnSend = (Button) this.findViewById(R.id.button);
238
+
239
+
240
+
241
+ btnSend.setOnClickListener(new View.OnClickListener(){
242
+
243
+ @Override
244
+
245
+ public void onClick(View v){
246
+
247
+ RadioGroup rgPlace = (RadioGroup)findViewById(R.id.rg_place);
248
+
249
+ int checkedId = rgPlace.getCheckedRadioButtonId();
250
+
251
+ String strPlace = ((RadioButton)findViewById(checkedId)).getText().toString();
252
+
253
+ EditText edit01 = (EditText)findViewById(R.id.editText);
254
+
255
+ String title = edit01.getText().toString();
256
+
257
+ Resources res = getResources();
258
+
259
+ Uri uri = Uri.parse("mailto:" + res.getString(R.string.mail_to).toString());
260
+
261
+ Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
262
+
263
+ intent.putExtra(Intent.EXTRA_SUBJECT, title);
264
+
265
+ intent.putExtra(Intent.EXTRA_TEXT, strPlace + "に迎えに来て");
266
+
267
+ startActivity(intent);
268
+
269
+ }
270
+
271
+
272
+
273
+ });
274
+
275
+ }
276
+
277
+ }
278
+
279
+ ```
44
280
 
45
281
 
46
282