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

質問編集履歴

4

情報修正

2017/06/03 03:06

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -10,29 +10,34 @@
10
10
  値を渡す方法を教えてください。
11
11
 
12
12
 
13
+
14
+
15
+ ※当初の投稿より変更しました。コールバック関数に引数を追加しました。
16
+
13
17
  ###発生している問題・エラーメッセージ
14
18
 
15
19
  ログを載せます。
16
20
  ```java
17
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: あ
18
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: []
19
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: い
20
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: あああ
21
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: []
22
- 06-03 10:50:37.061 10896-10896/station.around.aroundsatation I/System.out: いいい
23
- 06-03 10:50:37.204 10896-10924/station.around.aroundsatation D/OpenGLRenderer: endAllActiveAnimators on 0x9b340e00 (RippleDrawable) with handle 0xac2ec260
24
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: [station.around.aroundsatation.model.ListImage@f9ff7a1, station.around.aroundsatation.model.ListImage@c15adc6, station.around.aroundsatation.model.ListImage@d518187, station.around.aroundsatation.model.ListImage@69578b4, station.around.aroundsatation.model.ListImage@7a36cdd]
25
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@f9ff7a1
26
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: http://i.imgur.com/9h81ns6.jpg----------HTTP通信で取得したJSONデータ
27
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@c15adc6
28
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: kamkack;m----------HTTP通信で取得したJSONデータ
29
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@d518187
30
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: lmascml;cal;----------HTTP通信で取得したJSONデータ
31
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@69578b4
32
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: lm;ac;mdc;lm----------HTTP通信で取得したJSONデータ
33
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@7a36cdd
34
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: l;dcmk;dck;----------HTTP通信で取得したJSONデ
35
- 06-03 10:50:37.207 10896-10896/station.around.aroundsatation I/System.out: コールバック成功!---------①コールバック関数
21
+ 06-03 12:01:27.429 32110-32110/station.around.aroundsatation I/System.out: あ
22
+ 06-03 12:01:27.429 32110-32110/station.around.aroundsatation I/System.out: []
23
+ 06-03 12:01:27.429 32110-32110/station.around.aroundsatation I/System.out: い
24
+ 06-03 12:01:27.430 32110-32110/station.around.aroundsatation I/System.out: あああ
25
+ 06-03 12:01:27.430 32110-32110/station.around.aroundsatation I/System.out: []
26
+ 06-03 12:01:27.430 32110-32110/station.around.aroundsatation I/System.out: いいい
27
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation I/System.out: [station.around.aroundsatation.model.ListImage@f36cbfa, station.around.aroundsatation.model.ListImage@9d735ab, station.around.aroundsatation.model.ListImage@3e2408, station.around.aroundsatation.model.ListImage@f9ff7a1, station.around.aroundsatation.model.ListImage@c15adc6]
28
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@f36cbfa
29
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation I/System.out: http://i.imgur.com/9h81ns6.jpg
30
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@9d735ab
31
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation I/System.out: kamkack;m
32
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@3e2408
33
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation I/System.out: lmascml;cal;
34
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@f9ff7a1
35
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation I/System.out: lm;ac;mdc;lm
36
+ 06-03 12:01:27.603 32110-32110/station.around.aroundsatation D/debug3: station.around.aroundsatation.model.ListImage@c15adc6
37
+ 06-03 12:01:27.604 32110-32110/station.around.aroundsatation I/System.out: l;dcmk;dck;
38
+ 06-03 12:01:27.604 32110-32110/station.around.aroundsatation I/System.out: ルバック成功!
39
+ 06-03 12:01:27.604 32110-32110/station.around.aroundsatation I/System.out: [http://i.imgur.com/9h81ns6.jpg, kamkack;m, lmascml;cal;, lm;ac;mdc;lm, l;dcmk;dck;]
40
+ 06-03 12:01:27.652 32110-32130/station.around.aroundsatation D/OpenGLRenderer: endAllActiveAnimators on 0x9b336e00 (RippleDrawable) with handle 0x9b330390
36
41
  ```
37
42
 
38
43
 
@@ -83,7 +88,7 @@
83
88
  System.out.println(listImage.get(i).getEn_title());
84
89
  lists.add(listImage.get(i).getEn_title());
85
90
  }
86
- callback.callbackMethod(); ①コールバック関数
91
+ callback.callbackMethod(lists); ①コールバック関数
87
92
 
88
93
  }
89
94
 
@@ -176,9 +181,10 @@
176
181
  }
177
182
  }
178
183
 
179
- @Override
184
+ @Override ★引数設置★
180
- public void callbackMethod(){ ③コールバック関数★Viewに配列(lists)を渡す処理を書きたいです★
185
+ public void callbackMethod(List<String> lists){ ③コールバック関数★Viewに配列(lists)を渡す処理を書きたいです★
181
186
  System.out.println( "コールバック成功!");
187
+ System.out.println(lists);
182
188
  }
183
189
 
184
190
  }
@@ -201,7 +207,7 @@
201
207
 
202
208
  //コールバックインターフェース作成
203
209
  public interface CallHttpCallbacks {
204
- public void callbackMethod();
210
+ public void callbackMethod(List<String> lists); ★変更(引数設置)★
205
211
  }
206
212
 
207
213
  //コールバック対象クラス指定用インスタンス生成
@@ -212,9 +218,6 @@
212
218
  _callHttpCallbacks = callHttpCallbacks;
213
219
  }
214
220
 
215
- public void method() {
216
- _callHttpCallbacks.callbackMethod();
217
- }
218
221
  }
219
222
 
220
223
  ```

3

情報追加

2017/06/03 03:06

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -41,6 +41,10 @@
41
41
 
42
42
 
43
43
  HttpConnect.java
44
+
45
+ passListメソッドがHTTP通信でJSON配列データを取得します。
46
+ passList内のonResponseメソッド内にコールバック関数を仕込みました。
47
+
44
48
  ```Java
45
49
 
46
50
  import java.util.List;
@@ -102,6 +106,11 @@
102
106
 
103
107
 
104
108
  Present.java
109
+
110
+ setListAdapterメソッドの第三引数内に配列データが入ります。
111
+ コールバック関数で第三引数に取得した配列データをセットしたいです。
112
+ callbackMethodがコールバック関数です。
113
+
105
114
  ```Java
106
115
 
107
116
  public class Present extends Activity {

2

タグ削除

2017/06/03 02:21

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
File without changes

1

情報追加

2017/06/03 02:08

投稿

s.k
s.k

スコア423

title CHANGED
File without changes
body CHANGED
@@ -185,6 +185,29 @@
185
185
 
186
186
  ```
187
187
 
188
+ 一応、載せておきます。
189
+ CallHttp.java
190
+ ```Java
191
+ public class CallHttp {
188
192
 
193
+ //コールバックインターフェース作成
194
+ public interface CallHttpCallbacks {
195
+ public void callbackMethod();
196
+ }
189
197
 
198
+ //コールバック対象クラス指定用インスタンス生成
199
+ private CallHttpCallbacks _callHttpCallbacks;
200
+
201
+ //コールバック対象クラス指定メソッド
202
+ public void setCallbacks(CallHttpCallbacks callHttpCallbacks) {
203
+ _callHttpCallbacks = callHttpCallbacks;
204
+ }
205
+
206
+ public void method() {
207
+ _callHttpCallbacks.callbackMethod();
208
+ }
209
+ }
210
+
211
+ ```
212
+
190
213
  よろしくお願いします。