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

質問編集履歴

2

コードの改変

2019/08/05 04:22

投稿

sekaikan_ozaki
sekaikan_ozaki

スコア65

title CHANGED
File without changes
body CHANGED
@@ -36,10 +36,10 @@
36
36
  int matchCount = 0;
37
37
 
38
38
  for (int j = 0; j < timeList.size(); j++) {//CSVの要素を回す
39
- time = timeList.get(j);
40
- if (time.startsWith(text)) {//前方一致したら
39
+ if (timeList.get(j).startsWith(text)) {//前方一致したら
41
- //処理
40
+ textView.setText(timeList.get(j));
42
41
  matchCount++;
42
+ break;
43
43
  }
44
44
  }
45
45
 
@@ -48,8 +48,9 @@
48
48
 
49
49
  if(matchCount == 1) {
50
50
  for (int c = 0; c < tempList.size(); c++) {//CSVの要素を回す
51
- if (tempList.get(c).equals(temp)) {//完全一致したら
51
+ if (tempList.get(c).equals(temp)) {//完全一致
52
+ textView.setText(timeList.get(j));
52
- //処理
53
+ break;
53
54
  }
54
55
  }
55
56
  }

1

ソースコードの追記

2019/08/05 04:22

投稿

sekaikan_ozaki
sekaikan_ozaki

スコア65

title CHANGED
File without changes
body CHANGED
@@ -28,4 +28,35 @@
28
28
  for文が2個あるときは,どちらか片方の処理が遅くなる場合があります.
29
29
  処理時間が長くなってしまうことで, Skipped 996 frames!のように,その後の処理が実行されずに飛ばされてしまう弊害も起きてしまうので,なんとかしたいです.
30
30
 
31
+ ```java
32
+ //入力された日本語と適合する日本語を探して、対応する言語を表示するメソッド
33
+ public void match(String text) {
34
+
35
+
36
+ int matchCount = 0;
37
+
38
+ for (int j = 0; j < timeList.size(); j++) {//CSVの要素を回す
39
+ time = timeList.get(j);
40
+ if (time.startsWith(text)) {//前方一致したら
41
+ //処理
42
+ matchCount++;
43
+ }
44
+ }
45
+
46
+
47
+ //~~~~~~~~~~~
48
+
49
+ if(matchCount == 1) {
50
+ for (int c = 0; c < tempList.size(); c++) {//CSVの要素を回す
51
+ if (tempList.get(c).equals(temp)) {//完全一致したら
52
+ //処理
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+ }
59
+
60
+ ```
61
+
31
62
  これを直す方法はあるのでしょうか?