質問編集履歴

3

参照用ファイルの追加

2021/09/05 05:57

投稿

shinmo
shinmo

スコア9

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  上記表⑵の使用出来なかった端末にて
28
28
 
29
- Starting.java(以下記載)から画面遷移後のMenuName.java(以下記載)読み込み直後(※問題箇所)の
29
+ Starting.java(入力文字制限を超える為、コード省略)から”Intent”で画面遷移後のMenuName.java(以下記載)読み込み直後(※問題箇所)の
30
30
 
31
31
  android\os\Looper.csの中の"public static void loop()"関数にて、
32
32
 
@@ -48,472 +48,466 @@
48
48
 
49
49
 
50
50
 
51
+
52
+
53
+
54
+
55
+ ※Starting.javaからラジオボタンを使用し遷移後に以下のMenuName.java読み込み直後にエラー発生する。
56
+
51
- ```Starting
57
+ ```MenuName
52
58
 
53
59
  package com.example.xxx;
54
60
 
55
61
 
56
62
 
57
- import android.app.AlertDialog;
58
-
59
- import android.content.DialogInterface;
60
-
61
63
  import android.content.Intent;
62
64
 
63
65
  import android.os.Bundle;
64
66
 
65
67
  import android.view.View;
66
68
 
69
+ import android.widget.Button;
70
+
71
+ import android.widget.EditText;
72
+
67
73
  import android.widget.ImageView;
68
74
 
69
75
  import android.widget.RadioGroup;
70
76
 
77
+ import android.widget.Toast;
78
+
79
+
80
+
71
81
  import androidx.appcompat.app.AppCompatActivity;
72
82
 
73
83
 
74
84
 
75
85
 
76
86
 
77
- public class Starting extends AppCompatActivity {
87
+ public class MenuName extends AppCompatActivity {
78
-
79
-
80
-
88
+
89
+
90
+
81
- @Override
91
+ @Override
82
-
92
+
83
- public void onBackPressed() {
93
+ protected void onCreate(Bundle savedInstanceState) {
94
+
95
+ super.onCreate(savedInstanceState);
96
+
97
+ ※問題箇所→   setContentView(R.layout.activity_menu_name);
98
+
99
+
100
+
101
+ ```
102
+
103
+
104
+
105
+
106
+
107
+ R.layout.activity_menu_name↓
108
+
109
+ ```
110
+
111
+ <?xml version="1.0" encoding="utf-8"?>
112
+
113
+ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
114
+
115
+ xmlns:app="http://schemas.android.com/apk/res-auto"
116
+
117
+ xmlns:tools="http://schemas.android.com/tools"
118
+
119
+ android:layout_width="match_parent"
120
+
121
+ android:layout_height="match_parent"
122
+
123
+ tools:context=".MenuName">
124
+
125
+
126
+
127
+ <ImageView
128
+
129
+ android:id="@+id/imageView9"
130
+
131
+ android:layout_width="1147dp"
132
+
133
+ android:layout_height="952dp"
134
+
135
+ app:layout_constraintBottom_toBottomOf="parent"
136
+
137
+ app:layout_constraintEnd_toEndOf="parent"
138
+
139
+ app:layout_constraintHorizontal_bias="0.22"
140
+
141
+ app:layout_constraintStart_toStartOf="parent"
142
+
143
+ app:layout_constraintTop_toTopOf="parent"
144
+
145
+ app:layout_constraintVertical_bias="0.447"
146
+
147
+ app:srcCompat="@drawable/berrie" />
148
+
149
+
150
+
151
+ <Button
152
+
153
+ android:id="@+id/MenuNameButton"
154
+
155
+ android:layout_width="160dp"
156
+
157
+ android:layout_height="51dp"
158
+
159
+ android:layout_alignParentLeft="true"
160
+
161
+ android:layout_alignParentRight="true"
162
+
163
+ android:layout_alignParentBottom="true"
164
+
165
+ android:layout_marginBottom="236dp"
166
+
167
+ android:text="Search"
168
+
169
+ android:textSize="20sp"
170
+
171
+ app:backgroundTint="#A4AAAAAA"
172
+
173
+ app:layout_constraintBottom_toBottomOf="parent"
174
+
175
+ app:layout_constraintEnd_toEndOf="parent"
176
+
177
+ app:layout_constraintHorizontal_bias="0.498"
178
+
179
+ app:layout_constraintStart_toStartOf="parent"
180
+
181
+ app:layout_constraintTop_toBottomOf="@+id/MenuName"
182
+
183
+ app:layout_constraintVertical_bias="1.0" />
184
+
185
+
186
+
187
+ <EditText
188
+
189
+ android:id="@+id/MenuName"
190
+
191
+ android:layout_width="315dp"
192
+
193
+ android:layout_height="55dp"
194
+
195
+ android:layout_below="@+id/textView2"
196
+
197
+ android:layout_alignParentLeft="true"
198
+
199
+ android:layout_alignParentRight="true"
200
+
201
+ android:layout_marginStart="8dp"
202
+
203
+ android:layout_marginLeft="8dp"
204
+
205
+ android:layout_marginEnd="8dp"
206
+
207
+ android:layout_marginRight="8dp"
208
+
209
+ android:background="#A6FFFFFF"
210
+
211
+ android:ems="10"
212
+
213
+ android:inputType="textPersonName"
214
+
215
+ android:textColor="@color/black"
216
+
217
+ android:textSize="24sp"
218
+
219
+ app:layout_constraintBottom_toBottomOf="parent"
220
+
221
+ app:layout_constraintEnd_toEndOf="parent"
222
+
223
+ app:layout_constraintStart_toStartOf="parent"
224
+
225
+ app:layout_constraintTop_toTopOf="parent"
226
+
227
+ app:layout_constraintVertical_bias="0.353">
228
+
229
+
230
+
231
+ <requestFocus />
232
+
233
+ </EditText>
234
+
235
+ <LinearLayout
236
+
237
+ android:id="@+id/footerlayout2"
238
+
239
+ android:layout_width="match_parent"
240
+
241
+ android:layout_height="48dp"
242
+
243
+
244
+
245
+ android:layout_alignParentBottom="true"
246
+
247
+ android:background="#00FFFFFF"
248
+
249
+ app:layout_constraintBottom_toBottomOf="parent">
250
+
251
+
252
+
253
+ <RadioGroup
254
+
255
+ android:id="@+id/radioGroup"
256
+
257
+ android:layout_width="match_parent"
258
+
259
+ android:layout_height="match_parent"
260
+
261
+ android:background="@color/purple_200"
262
+
263
+ android:gravity="center|bottom"
264
+
265
+ android:orientation="horizontal">
266
+
267
+
268
+
269
+ <RadioButton
270
+
271
+ android:id="@+id/backhome"
272
+
273
+ android:layout_width="0dp"
274
+
275
+ android:layout_height="match_parent"
276
+
277
+ android:layout_weight="1"
278
+
279
+ android:button="@null"
280
+
281
+ android:foreground="@drawable/ic_home_black_24dp"
282
+
283
+ android:foregroundGravity="center"
284
+
285
+ android:gravity="bottom|center"
286
+
287
+ android:textColor="@color/black"
288
+
289
+ android:textSize="10sp" />
290
+
291
+
292
+
293
+ <RadioButton
294
+
295
+ android:id="@+id/sarch"
296
+
297
+ android:layout_width="0dp"
298
+
299
+ android:layout_height="match_parent"
300
+
301
+ android:layout_weight="1"
302
+
303
+ android:button="@null"
304
+
305
+ android:foreground="?android:attr/actionModeWebSearchDrawable"
306
+
307
+ android:foregroundGravity="center"
308
+
309
+ android:gravity="bottom|center"
310
+
311
+ android:textAllCaps="false"
312
+
313
+ android:textSize="10sp" />
314
+
315
+
316
+
317
+ <RadioButton
318
+
319
+ android:id="@+id/sarch2"
320
+
321
+ android:layout_width="0dp"
322
+
323
+ android:layout_height="match_parent"
324
+
325
+ android:layout_weight="1"
326
+
327
+ android:button="@null"
328
+
329
+ android:foreground="?android:attr/actionModeFindDrawable"
330
+
331
+ android:foregroundGravity="center"
332
+
333
+ android:gravity="bottom|center"
334
+
335
+ android:textAllCaps="false"
336
+
337
+ android:textSize="10sp" />
338
+
339
+
340
+
341
+ <RadioButton
342
+
343
+ android:id="@+id/sarch3"
344
+
345
+ android:layout_width="0dp"
346
+
347
+ android:layout_height="match_parent"
348
+
349
+ android:layout_weight="1"
350
+
351
+ android:button="@null"
352
+
353
+ android:foreground="@drawable/add_insert_plus_icon_149546"
354
+
355
+ android:foregroundGravity="center"
356
+
357
+ android:gravity="bottom|center"
358
+
359
+ android:textSize="10sp" />
360
+
361
+
362
+
363
+
364
+
365
+ </RadioGroup>
366
+
367
+ </LinearLayout>
368
+
369
+
370
+
371
+ </androidx.constraintlayout.widget.ConstraintLayout>
372
+
373
+ ```
374
+
375
+ ### 試したこと
376
+
377
+
378
+
379
+
380
+
381
+ ▪️PCの再起動
382
+
383
+
384
+
385
+ ▪️プロジェクトのキャッシュの破棄、再起動
386
+
387
+
388
+
389
+ ▪️以下のコマンドをターミナルで実行して、Gradleの依存関係をリフレッシュする。
390
+
391
+
392
+
393
+    ./gradlew build --refresh-dependencies
394
+
395
+
396
+
397
+ ### 補足情報
398
+
399
+
400
+
401
+ ```gradle
402
+
403
+                                                                                                                          ※以下build.gradle(:app)
404
+
405
+
406
+
407
+ plugins {
408
+
409
+ id 'com.android.application'
410
+
411
+ }
412
+
413
+
414
+
415
+ android {
416
+
417
+ compileSdkVersion 29
418
+
419
+ buildToolsVersion "29.0.3"
420
+
421
+
422
+
423
+ defaultConfig {
424
+
425
+ applicationId "com.example.xxx"
426
+
427
+ minSdkVersion 16
428
+
429
+ targetSdkVersion 29
430
+
431
+ versionCode 1
432
+
433
+ versionName "1.0"
434
+
435
+
436
+
437
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
84
438
 
85
439
  }
86
440
 
87
441
 
88
442
 
89
- @Override
90
-
91
- public void onCreate(Bundle savedInstanceState) {
92
-
93
- super.onCreate(savedInstanceState);
94
-
95
- setContentView(R.layout.activity_starting);
96
-
97
-
98
-
99
- Intent intent1 = getIntent();
100
-
101
-
102
-
103
- // ラジオグループのオブジェクトを取得
104
-
105
- RadioGroup rg = (RadioGroup)findViewById(R.id.radioGroup);
106
-
107
-
108
-
109
- // ラジオグループのチェック状態変更イベントを登録
110
-
111
- rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
112
-
113
-
114
-
115
- // チェック状態変更時に呼び出されるメソッド
116
-
117
- public void onCheckedChanged(RadioGroup arg0, int arg1) {
118
-
119
- if(arg0 == rg){
120
-
121
- switch(arg1){
443
+ buildTypes {
122
-
123
-
124
-
125
- //ラジオボタン1が押されたとき
444
+
126
-
127
- case R.id.sarch2:
128
-
129
- Intent intent = new Intent(getApplication(), Select.class);
130
-
131
- startActivity(intent);
132
-
133
- break;
445
+ release {
134
-
135
- //ラジオボタン2が押されたとき
446
+
136
-
137
- case R.id.sarch:
447
+ minifyEnabled false
138
-
448
+
139
- Intent intent2 = new Intent(getApplication(), MenuName.class);
449
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
140
-
141
- startActivity(intent2);
450
+
142
-
143
- break;
144
-
145
- case R.id.sarch3:
146
-
147
- Intent intent3 = new Intent(getApplication(), Update.class);
148
-
149
- startActivity(intent3);
150
-
151
- break;
152
-
153
-
154
-
155
- }
451
+ }
156
-
157
- }
158
-
159
- }
160
-
161
- });
162
-
163
-
164
-
165
-
166
-
167
- });
168
-
169
-
170
452
 
171
453
  }
172
454
 
173
-
455
+ compileOptions {
456
+
174
-
457
+ sourceCompatibility JavaVersion.VERSION_1_8
458
+
175
-
459
+ targetCompatibility JavaVersion.VERSION_1_8
460
+
461
+ }
462
+
463
+
464
+
465
+
176
466
 
177
467
  }
178
468
 
469
+
470
+
471
+ dependencies {
472
+
473
+
474
+
475
+ implementation 'androidx.appcompat:appcompat:1.2.0'
476
+
477
+ testImplementation 'junit:junit:4.+'
478
+
479
+ implementation 'com.google.android.material:material:1.2.'
480
+
481
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
482
+
483
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
484
+
485
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
486
+
487
+
488
+
489
+ implementation 'com.google.android.material:material:1.2.0'
490
+
491
+
492
+
493
+
494
+
495
+ implementation 'androidx.navigation:navigation-fragment:2.3.2'
496
+
497
+
498
+
499
+ implementation 'androidx.navigation:navigation-ui:2.3.2'
500
+
501
+ implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
502
+
503
+ implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
504
+
505
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
506
+
507
+
508
+
509
+ }
510
+
511
+
512
+
179
513
  ```
180
-
181
- ※上記のStarting.javaからラジオボタンを使用し遷移後に以下のMenuName.java読み込み直後にエラー発生する。
182
-
183
- ```MenuName
184
-
185
- package com.example.xxx;
186
-
187
-
188
-
189
- import android.content.Intent;
190
-
191
- import android.os.Bundle;
192
-
193
- import android.view.View;
194
-
195
- import android.widget.Button;
196
-
197
- import android.widget.EditText;
198
-
199
- import android.widget.ImageView;
200
-
201
- import android.widget.RadioGroup;
202
-
203
- import android.widget.Toast;
204
-
205
-
206
-
207
- import androidx.appcompat.app.AppCompatActivity;
208
-
209
-
210
-
211
-
212
-
213
- public class MenuName extends AppCompatActivity {
214
-
215
-
216
-
217
- @Override
218
-
219
- protected void onCreate(Bundle savedInstanceState) {
220
-
221
- super.onCreate(savedInstanceState);
222
-
223
- ※問題箇所→   setContentView(R.layout.activity_menu_name);
224
-
225
-
226
-
227
- ```
228
-
229
-
230
-
231
-
232
-
233
- R.layout.activity_menu_name↓
234
-
235
- ```
236
-
237
- <?xml version="1.0" encoding="utf-8"?>
238
-
239
- <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
240
-
241
- xmlns:app="http://schemas.android.com/apk/res-auto"
242
-
243
- xmlns:tools="http://schemas.android.com/tools"
244
-
245
- android:layout_width="match_parent"
246
-
247
- android:layout_height="match_parent"
248
-
249
- tools:context=".MenuName">
250
-
251
-
252
-
253
- <ImageView
254
-
255
- android:id="@+id/imageView9"
256
-
257
- android:layout_width="1147dp"
258
-
259
- android:layout_height="952dp"
260
-
261
- app:layout_constraintBottom_toBottomOf="parent"
262
-
263
- app:layout_constraintEnd_toEndOf="parent"
264
-
265
- app:layout_constraintHorizontal_bias="0.22"
266
-
267
- app:layout_constraintStart_toStartOf="parent"
268
-
269
- app:layout_constraintTop_toTopOf="parent"
270
-
271
- app:layout_constraintVertical_bias="0.447"
272
-
273
- app:srcCompat="@drawable/berrie" />
274
-
275
-
276
-
277
- <Button
278
-
279
- android:id="@+id/MenuNameButton"
280
-
281
- android:layout_width="160dp"
282
-
283
- android:layout_height="51dp"
284
-
285
- android:layout_alignParentLeft="true"
286
-
287
- android:layout_alignParentRight="true"
288
-
289
- android:layout_alignParentBottom="true"
290
-
291
- android:layout_marginBottom="236dp"
292
-
293
- android:text="Search"
294
-
295
- android:textSize="20sp"
296
-
297
- app:backgroundTint="#A4AAAAAA"
298
-
299
- app:layout_constraintBottom_toBottomOf="parent"
300
-
301
- app:layout_constraintEnd_toEndOf="parent"
302
-
303
- app:layout_constraintHorizontal_bias="0.498"
304
-
305
- app:layout_constraintStart_toStartOf="parent"
306
-
307
- app:layout_constraintTop_toBottomOf="@+id/MenuName"
308
-
309
- app:layout_constraintVertical_bias="1.0" />
310
-
311
-
312
-
313
- <EditText
314
-
315
- android:id="@+id/MenuName"
316
-
317
- android:layout_width="315dp"
318
-
319
- android:layout_height="55dp"
320
-
321
- android:layout_below="@+id/textView2"
322
-
323
- android:layout_alignParentLeft="true"
324
-
325
- android:layout_alignParentRight="true"
326
-
327
- android:layout_marginStart="8dp"
328
-
329
- android:layout_marginLeft="8dp"
330
-
331
- android:layout_marginEnd="8dp"
332
-
333
- android:layout_marginRight="8dp"
334
-
335
- android:background="#A6FFFFFF"
336
-
337
- android:ems="10"
338
-
339
- android:inputType="textPersonName"
340
-
341
- android:textColor="@color/black"
342
-
343
- android:textSize="24sp"
344
-
345
- app:layout_constraintBottom_toBottomOf="parent"
346
-
347
- app:layout_constraintEnd_toEndOf="parent"
348
-
349
- app:layout_constraintStart_toStartOf="parent"
350
-
351
- app:layout_constraintTop_toTopOf="parent"
352
-
353
- app:layout_constraintVertical_bias="0.353">
354
-
355
-
356
-
357
- <requestFocus />
358
-
359
- </EditText>
360
-
361
- <LinearLayout
362
-
363
- android:id="@+id/footerlayout2"
364
-
365
- android:layout_width="match_parent"
366
-
367
- android:layout_height="48dp"
368
-
369
-
370
-
371
- android:layout_alignParentBottom="true"
372
-
373
- android:background="#00FFFFFF"
374
-
375
- app:layout_constraintBottom_toBottomOf="parent">
376
-
377
-
378
-
379
- <RadioGroup
380
-
381
- android:id="@+id/radioGroup"
382
-
383
- android:layout_width="match_parent"
384
-
385
- android:layout_height="match_parent"
386
-
387
- android:background="@color/purple_200"
388
-
389
- android:gravity="center|bottom"
390
-
391
- android:orientation="horizontal">
392
-
393
-
394
-
395
- <RadioButton
396
-
397
- android:id="@+id/backhome"
398
-
399
- android:layout_width="0dp"
400
-
401
- android:layout_height="match_parent"
402
-
403
- android:layout_weight="1"
404
-
405
- android:button="@null"
406
-
407
- android:foreground="@drawable/ic_home_black_24dp"
408
-
409
- android:foregroundGravity="center"
410
-
411
- android:gravity="bottom|center"
412
-
413
- android:textColor="@color/black"
414
-
415
- android:textSize="10sp" />
416
-
417
-
418
-
419
- <RadioButton
420
-
421
- android:id="@+id/sarch"
422
-
423
- android:layout_width="0dp"
424
-
425
- android:layout_height="match_parent"
426
-
427
- android:layout_weight="1"
428
-
429
- android:button="@null"
430
-
431
- android:foreground="?android:attr/actionModeWebSearchDrawable"
432
-
433
- android:foregroundGravity="center"
434
-
435
- android:gravity="bottom|center"
436
-
437
- android:textAllCaps="false"
438
-
439
- android:textSize="10sp" />
440
-
441
-
442
-
443
- <RadioButton
444
-
445
- android:id="@+id/sarch2"
446
-
447
- android:layout_width="0dp"
448
-
449
- android:layout_height="match_parent"
450
-
451
- android:layout_weight="1"
452
-
453
- android:button="@null"
454
-
455
- android:foreground="?android:attr/actionModeFindDrawable"
456
-
457
- android:foregroundGravity="center"
458
-
459
- android:gravity="bottom|center"
460
-
461
- android:textAllCaps="false"
462
-
463
- android:textSize="10sp" />
464
-
465
-
466
-
467
- <RadioButton
468
-
469
- android:id="@+id/sarch3"
470
-
471
- android:layout_width="0dp"
472
-
473
- android:layout_height="match_parent"
474
-
475
- android:layout_weight="1"
476
-
477
- android:button="@null"
478
-
479
- android:foreground="@drawable/add_insert_plus_icon_149546"
480
-
481
- android:foregroundGravity="center"
482
-
483
- android:gravity="bottom|center"
484
-
485
- android:textSize="10sp" />
486
-
487
-
488
-
489
-
490
-
491
- </RadioGroup>
492
-
493
- </LinearLayout>
494
-
495
-
496
-
497
- </androidx.constraintlayout.widget.ConstraintLayout>
498
-
499
- ```
500
-
501
- ### 試したこと
502
-
503
-
504
-
505
-
506
-
507
- ▪️PCの再起動
508
-
509
-
510
-
511
- ▪️プロジェクトのキャッシュの破棄、再起動
512
-
513
-
514
-
515
- ▪️以下のコマンドをターミナルで実行して、Gradleの依存関係をリフレッシュする。
516
-
517
-
518
-
519
-    ./gradlew build --refresh-dependencies

2

参照用ファイルの追加

2021/09/05 05:57

投稿

shinmo
shinmo

スコア9

test CHANGED
File without changes
test CHANGED
File without changes

1

参照用ファイルの追加

2021/09/05 05:48

投稿

shinmo
shinmo

スコア9

test CHANGED
File without changes
test CHANGED
File without changes