ボタンに対して次の onClick コマンドを取得しました。しかし、私がそれを呼び出すと、何も表示されませんコード:
public void onClick(View v) {
Log.d("debug", "before loadGutschein");
loadGutschein();
ViewFlipperVino.setDisplayedChild(3);
layout_number = 3;
Log.d("debug", "after loadGutschein");
bottomAudioLogosLayout.postDelayed(new Runnable() {
DisplayMetrics metrics = getActivity().getResources().getDisplayMetrics();
int width = metrics.widthPixels;
@Override
public void run() {
Log.d("debug", "couponsout=" + coupons);
if (coupons != null) {
int coupSize = coupons.size();
final int itemWidth = (width / coupSize) - 5;
for (int i = 0; i < coupSize; i++) {
Coupon coupon = coupons.get(i);
if (coupon.getImage() != null) {
final CheckBox cb = new CheckBox(getActivity());
final ImageView iv = new ImageView(getActivity());
iv.setScaleType(ScaleType.CENTER_INSIDE);
LayoutParams linearLayoutParams = new LayoutParams();
iv.setLayoutParams(linearLayoutParams);
cb.setLayoutParams(linearLayoutParams);
bottomAudioLogosLayout.addView(iv);
bottomAudioLogosLayout.addView(cb);
ImageUtil.loadImage(coupon.getImage(), iv, -1, -1, "", false);
}
}
}
}
}, 200);
}
============LoadGutschein メソッド:
private void loadGutschein() {
ServiceProxy.createWebServiceTask(getActivity(), new RemoteCallListener() {
@Override
public void onRemoteCallError(String response) {
Log.e("error", "onRemoteCallError is ==>" + response);
}
@Override
public void onRemoteCallComplete(Object response) {
Log.d("debug", "response is = " + response + "\t" + response.getClass());
coupons = (Coupons) response;
Log.d("debug", "coupons = " + coupons);
}
@Override
public void onNoInternetError() {
Log.e("error", "onNoInternetError");
}
@Override
public void onNoAccess() {
Log.e("error", "onNoAccess");
}
}, true, true).invokeGetCoupons();
}
=========MY LOGCAT ログ:
08-13 14:36:11.382: D/debug(17576): gutscheinName= e
08-13 14:36:11.382: D/debug(17576): gutscheinHN= d
08-13 14:36:11.382: D/debug(17576): gutscheinCash= 50
08-13 14:36:11.382: D/debug(17576): before loadGutschein
08-13 14:36:11.445: D/debug(17576): after loadGutschein
08-13 14:36:11.515: I/WEB-SERVER-CLIENT GET :(17576): http://developer.weinco.de/api/v1/getCoupons?
08-13 14:36:11.648: D/debug(17576): couponsout=null
08-13 14:36:11.742: D/debug(17576): response is = [Coupon [Name=Rabatt, Code=321, GueltigBis=2014-09-01, Typ=absolut, Wert=10, GueltigAb=2011-09-01, Gueltig=alle]] class com.weinco.webservice.entity.Coupons
08-13 14:36:11.742: D/debug(17576): coupons = [Coupon [Name=Rabatt, Code=321, GueltigBis=2014-09-01, Typ=absolut, Wert=10, GueltigAb=2011-09-01, Gueltig=alle]]
Web サービスからのクーポンが応答の値を取得する場合、postDelayed (logcat の Couponsout) のクーポン値が null である理由がわかりません。どうすればこれを解決できますか?