質問編集履歴

16

2018/07/14 07:02

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
File without changes

15

タグにAndroidを追加し、また、本文を修正しました。

2018/07/14 07:02

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- 私がやりたい事は、下記のURLに行くと機種検索のテキストボックスと検索ボタンが
5
+ 私がやりたい事は、Androidで下記のURLに行くと機種検索のテキストボックスと検索ボタンがありますが、自動でこのテキストボックスに検索キーワード入力し、その後にこのボタンの押下まで行いたいのです。
6
-
7
- ありますが、自動でこのテキストボックスに検索キーワード入力し、その後に
8
-
9
- このボタンの押下まで行いたいのです。
10
6
 
11
7
 
12
8
 
@@ -16,7 +12,7 @@
16
12
 
17
13
 
18
14
 
19
- ■URL
15
+ ■URL http://www.p-world.co.jp/sp/machine.cgi
20
16
 
21
17
  [リンク内容](http://www.p-world.co.jp/sp/machine.cgi)
22
18
 

14

タイトル修正しました。

2018/07/13 20:43

投稿

hiropee
hiropee

スコア12

test CHANGED
@@ -1 +1 @@
1
- JAVAで、自動でWEB内のテキストボックスの入力からボタン押下までをする方法について
1
+ JAVAで、自動でWEB内のテキストボックスの入力からボタン押下まで行う方法について
test CHANGED
File without changes

13

文章を修正しました。

2018/07/13 05:23

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- 私はJAVA初心者でAndroidStudio3.0.1を使用し始めて数週間の者です。
1
+ 私はJAVAもアプリ開発も初心者です。
2
2
 
3
3
 
4
4
 
@@ -16,17 +16,9 @@
16
16
 
17
17
 
18
18
 
19
- ★また、"https://teratail.com/questions/8365"で当サイトに辿り着いたのですが、この方法ではうまくいきませんでした。
20
-
21
-
22
-
23
19
  ■URL
24
20
 
25
- ~~https://www.p-world.co.jp/database/machine.html~~
26
-
27
- スマホでは下記に変換されていました申し訳ありません。
28
-
29
- http://www.p-world.co.jp/sp/machine.cgi
21
+ [リンク内容](http://www.p-world.co.jp/sp/machine.cgi)
30
22
 
31
23
  ![イメージ説明](7476a77e01d4ea0e69b2a7b8583a6759.png)
32
24
 
@@ -262,4 +254,4 @@
262
254
 
263
255
  上記は、検索キーワードをURLの後ろに追加して出来るパターンのものです。
264
256
 
265
- 先にも述べましたが、URLは今回別のものになります。
257
+ 以上、よろくお願いいます。

12

画像を追加しました。

2018/07/13 05:11

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  http://www.p-world.co.jp/sp/machine.cgi
30
30
 
31
-
31
+ ![イメージ説明](7476a77e01d4ea0e69b2a7b8583a6759.png)
32
32
 
33
33
  コーディングについてご教示のほど、よろしくお願いいたします。
34
34
 

11

タイトルの頭にmがついていたため修正いたしました。

2018/04/18 10:51

投稿

hiropee
hiropee

スコア12

test CHANGED
@@ -1 +1 @@
1
- JAVAで、自動でWEB内のテキストボックスの入力からボタン押下までをする方法について
1
+ JAVAで、自動でWEB内のテキストボックスの入力からボタン押下までをする方法について
test CHANGED
File without changes

10

先ほど修正した内容を再度修正いたしました。

2018/04/14 18:52

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  ~~https://www.p-world.co.jp/database/machine.html~~
26
26
 
27
- スマホからでは下記した申し訳ありません。
27
+ スマホでは下記に変換されていました申し訳ありません。
28
28
 
29
29
  http://www.p-world.co.jp/sp/machine.cgi
30
30
 

9

URLにあやまりがありましたので修正いたしました。申し訳ありません。

2018/04/14 18:22

投稿

hiropee
hiropee

スコア12

test CHANGED
@@ -1 +1 @@
1
- JAVAで、自動でWEB内のテキストボックスの入力からボタン押下までをする方法について
1
+ JAVAで、自動でWEB内のテキストボックスの入力からボタン押下までをする方法について
test CHANGED
@@ -22,7 +22,11 @@
22
22
 
23
23
  ■URL
24
24
 
25
- https://www.p-world.co.jp/database/machine.html
25
+ ~~https://www.p-world.co.jp/database/machine.html~~
26
+
27
+ スマホからでは下記でした申し訳ありません。
28
+
29
+ http://www.p-world.co.jp/sp/machine.cgi
26
30
 
27
31
 
28
32
 

8

★また、"https://teratail.com/questions/8365"で当サイトに辿り着いたのですが、この方法ではうまくいきませんでした。 を追記いたしました。

2018/04/14 18:18

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -16,6 +16,10 @@
16
16
 
17
17
 
18
18
 
19
+ ★また、"https://teratail.com/questions/8365"で当サイトに辿り着いたのですが、この方法ではうまくいきませんでした。
20
+
21
+
22
+
19
23
  ■URL
20
24
 
21
25
  https://www.p-world.co.jp/database/machine.html

7

"※検索は、テキストからと音声入力からの2箇所あります。"を追加しました。

2018/04/14 07:51

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -30,6 +30,8 @@
30
30
 
31
31
  作成済みのソースコードを改造したいと考えています。
32
32
 
33
+ ※検索は、テキストからと音声入力からの2箇所あります。
34
+
33
35
  ```ここに言語を入力
34
36
 
35
37
  import android.content.Activity

6

余計な文字があったため削除いたしました。

2018/04/13 19:36

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -34,8 +34,6 @@
34
34
 
35
35
  import android.content.Activity
36
36
 
37
- NotFoundException;
38
-
39
37
  import android.content.Intent;
40
38
 
41
39
  import android.net.Uri;

5

ソースコードが崩れてしまいましたので再度ソースコードを整形いたしました。

2018/04/13 19:23

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,9 @@
32
32
 
33
33
  ```ここに言語を入力
34
34
 
35
- import android.content.ActivityNotFoundException;
35
+ import android.content.Activity
36
+
37
+ NotFoundException;
36
38
 
37
39
  import android.content.Intent;
38
40
 
@@ -246,6 +248,8 @@
246
248
 
247
249
  }
248
250
 
251
+ ```
252
+
249
253
  ==================================================================
250
254
 
251
255
  上記は、検索キーワードをURLの後ろに追加して出来るパターンのものです。

4

余分なコード入力欄を削除いたしました。

2018/04/13 19:19

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -246,12 +246,6 @@
246
246
 
247
247
  }
248
248
 
249
- ``````ここに言語を入力
250
-
251
- コード
252
-
253
- ```
254
-
255
249
  ==================================================================
256
250
 
257
251
  上記は、検索キーワードをURLの後ろに追加して出来るパターンのものです。

3

下の’;’が抜けておりましたのでソースコードを整形しました。

2018/04/13 19:14

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -34,29 +34,27 @@
34
34
 
35
35
  import android.content.ActivityNotFoundException;
36
36
 
37
- import android.content.Intent;
37
+ import android.content.Intent;
38
-
38
+
39
- import android.net.Uri;
39
+ import android.net.Uri;
40
-
40
+
41
- import android.speech.RecognizerIntent;
41
+ import android.speech.RecognizerIntent;
42
-
42
+
43
- import android.support.v7.app.AppCompatActivity;
43
+ import android.support.v7.app.AppCompatActivity;
44
-
44
+
45
- import android.os.Bundle;
45
+ import android.os.Bundle;
46
-
46
+
47
- import android.view.MotionEvent;
47
+ import android.view.MotionEvent;
48
-
48
+
49
- import android.view.View;
49
+ import android.view.View;
50
-
50
+
51
- import android.widget.Button;
51
+ import android.widget.Button;
52
-
52
+
53
- import android.widget.EditText;
53
+ import android.widget.EditText;
54
-
54
+
55
- import android.widget.Toast;
55
+ import android.widget.Toast;
56
-
57
-
58
-
56
+
59
- import java.util.ArrayList;
57
+ import java.util.ArrayList;
60
58
 
61
59
 
62
60
 
@@ -124,10 +122,6 @@
124
122
 
125
123
  startActivity(i);
126
124
 
127
-
128
-
129
-
130
-
131
125
  }
132
126
 
133
127
  }
@@ -246,10 +240,16 @@
246
240
 
247
241
  }
248
242
 
249
-
250
-
251
243
  super.onActivityResult(requestCode, resultCode, data);
252
244
 
245
+ }
246
+
247
+ }
248
+
249
+ ``````ここに言語を入力
250
+
251
+ コード
252
+
253
253
  ```
254
254
 
255
255
  ==================================================================

2

初心者マーク付けられました。

2018/04/13 19:12

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
File without changes

1

ソースコードを追加いたしました。

2018/04/13 13:27

投稿

hiropee
hiropee

スコア12

test CHANGED
File without changes
test CHANGED
@@ -23,3 +23,237 @@
23
23
 
24
24
 
25
25
  コーディングについてご教示のほど、よろしくお願いいたします。
26
+
27
+
28
+
29
+ ==================================================================
30
+
31
+ 作成済みのソースコードを改造したいと考えています。
32
+
33
+ ```ここに言語を入力
34
+
35
+ import android.content.ActivityNotFoundException;
36
+
37
+ import android.content.Intent;
38
+
39
+ import android.net.Uri;
40
+
41
+ import android.speech.RecognizerIntent;
42
+
43
+ import android.support.v7.app.AppCompatActivity;
44
+
45
+ import android.os.Bundle;
46
+
47
+ import android.view.MotionEvent;
48
+
49
+ import android.view.View;
50
+
51
+ import android.widget.Button;
52
+
53
+ import android.widget.EditText;
54
+
55
+ import android.widget.Toast;
56
+
57
+
58
+
59
+ import java.util.ArrayList;
60
+
61
+
62
+
63
+ public class MainActivity extends AppCompatActivity {
64
+
65
+ // リクエストを識別するための変数宣言。適当な数字でよい
66
+
67
+ private static final int REQUEST_CODE = 0;
68
+
69
+
70
+
71
+ @Override
72
+
73
+ protected void onCreate(Bundle savedInstanceState) {
74
+
75
+ super.onCreate(savedInstanceState);
76
+
77
+ setContentView(R.layout.activity_main);
78
+
79
+
80
+
81
+ //表示ボタンであるButtonオブジェクトを取得。
82
+
83
+ Button btClick = (Button) findViewById(R.id.btClick);
84
+
85
+ //リスナクラスのインスタンスを生成。
86
+
87
+ PachiListener listener = new PachiListener();
88
+
89
+ //表示ボタンにリスナを設定。
90
+
91
+ btClick.setOnClickListener(listener);
92
+
93
+
94
+
95
+ }
96
+
97
+
98
+
99
+ private class PachiListener implements View.OnClickListener {
100
+
101
+ //定義
102
+
103
+ EditText input = (EditText) findViewById(R.id.editText1);
104
+
105
+
106
+
107
+ @Override
108
+
109
+ public void onClick(View view) {
110
+
111
+ String inputStr = input.getText().toString();
112
+
113
+ String a = "https://777-pachinko.com/site_search?cat_name=7&seach_txt=";
114
+
115
+ String b;
116
+
117
+ b = a + inputStr;
118
+
119
+
120
+
121
+ Uri uri = Uri.parse(b);
122
+
123
+ Intent i = new Intent(Intent.ACTION_VIEW,uri);
124
+
125
+ startActivity(i);
126
+
127
+
128
+
129
+
130
+
131
+ }
132
+
133
+ }
134
+
135
+
136
+
137
+ // タッチイベントが起きたら呼ばれる関数
138
+
139
+ public boolean onTouchEvent(MotionEvent event) {
140
+
141
+ // 画面から指が離れるイベントの場合のみ実行
142
+
143
+ if (event.getAction() == MotionEvent.ACTION_UP) {
144
+
145
+ try {
146
+
147
+ // 音声認識プロンプトを立ち上げるインテント作成
148
+
149
+ Intent intent = new Intent(
150
+
151
+ RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
152
+
153
+ // 言語モデルをfree-form speech recognitionに設定
154
+
155
+ // web search terms用のLANGUAGE_MODEL_WEB_SEARCHにすると検索画面になる
156
+
157
+ intent.putExtra(
158
+
159
+ RecognizerIntent.EXTRA_LANGUAGE_MODEL,
160
+
161
+ RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
162
+
163
+ // プロンプトに表示する文字を設定
164
+
165
+ intent.putExtra(
166
+
167
+ RecognizerIntent.EXTRA_PROMPT,
168
+
169
+ "話してください");
170
+
171
+ // インテント発行
172
+
173
+ startActivityForResult(intent, REQUEST_CODE);
174
+
175
+ } catch (ActivityNotFoundException e) {
176
+
177
+ // エラー表示
178
+
179
+ Toast.makeText(MainActivity.this,
180
+
181
+ "ActivityNotFoundException", Toast.LENGTH_LONG).show();
182
+
183
+ }
184
+
185
+ }
186
+
187
+ return true;
188
+
189
+ }
190
+
191
+
192
+
193
+ // startActivityForResultで起動したアクティビティが終了した時に呼び出される関数
194
+
195
+ @Override
196
+
197
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
198
+
199
+ // 音声認識結果のとき
200
+
201
+ if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
202
+
203
+ // 結果文字列リストを取得
204
+
205
+ ArrayList<String> results = data.getStringArrayListExtra(
206
+
207
+ RecognizerIntent.EXTRA_RESULTS);
208
+
209
+ // 取得した文字列を結合
210
+
211
+ String resultsString = "";
212
+
213
+ for (int i = 0; i < results.size(); i++) {
214
+
215
+ resultsString += results.get(i);
216
+
217
+ //追加
218
+
219
+ break;
220
+
221
+ }
222
+
223
+
224
+
225
+ //追加
226
+
227
+ String a = "https://777-pachinko.com/site_search?cat_name=7&seach_txt=";
228
+
229
+ String b;
230
+
231
+ b = a + resultsString;
232
+
233
+
234
+
235
+ Uri uri = Uri.parse(b);
236
+
237
+ Intent i = new Intent(Intent.ACTION_VIEW,uri);
238
+
239
+ startActivity(i);
240
+
241
+
242
+
243
+ // トーストを使って結果表示
244
+
245
+ Toast.makeText(this, resultsString, Toast.LENGTH_LONG).show();
246
+
247
+ }
248
+
249
+
250
+
251
+ super.onActivityResult(requestCode, resultCode, data);
252
+
253
+ ```
254
+
255
+ ==================================================================
256
+
257
+ 上記は、検索キーワードをURLの後ろに追加して出来るパターンのものです。
258
+
259
+ 先にも述べましたが、URLは今回別のものになります。