2017-09-08 5 views
-2

に渡すRetrofitのコンセプトを使用しています。リストの値をアクティビティに渡す必要があります。ここで私はバックエンドからの応答を取得するコードを添付しました。カスタムリスト値アダプタをアクティビティ

private void callCheckTopCourseDetails(String getId) { 
    APIInterface apiInterface = APIClient.getClient().create(APIInterface.class); 
    Call<Example> call2 = apiInterface.doGetWishlist(getId); 
    call2.enqueue(new Callback<Example>() { 
     @Override 
     public void onResponse(Call<Example> call, Response<Example> response) { 
      if (response.code() == RESPONSECODE_200 || response.code() == RESPONSECODE_201) { 
       List<RatingsDetail> getRatingDetails = response.body().getAndroid().getRatingsDetails(); 
       List<CourseDetail> getCourseDetail = response.body().getAndroid().getCoursedetails(); 
      } 
     } 

     @Override 
     public void onFailure(Call<Example> call, Throwable t) { 
      Log.i("ttttttttt", "" + t); 
      call.cancel(); 
     } 
    }); 
} 
+0

を通過しましたか? [良い質問をするにはどうすればいいですか](https://stackoverflow.com/help/how-to-ask)をご覧ください。スタックオーバーフローはコーディングサービスではありません。あなたはあなたの問題を研究し、投稿する前に自分でコードを書いてみることを期待しています。あなたが*特定の*に固執するならば、戻ってきて正確な問題の概要とあなたが試したものの概要を含めてください。 – FluffyKitten

+0

バンドルバンドル= newバンドル(); bundle.putString( "RatingDetails"、String.valueOf(getRatingDetails)); 意図インテント=新しいインテント(context、CourseDetailActivity.class); intent.putExtras(bundle); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent);私はこのように試しています –

答えて

1

私はあなたがこれを行うために自分自身を試してみました何、このように私のためにその作業

private void callCheckTopCourseDetails(String getId) { 
    APIInterface apiInterface = APIClient.getClient().create(APIInterface.class); 
    Call<Example> call2 = apiInterface.doGetWishlist(getId); 
    call2.enqueue(new Callback<Example>() { 
     @Override 
     public void onResponse(Call<Example> call, Response<Example> response) { 
      if (response.code() == RESPONSECODE_200 || response.code() == RESPONSECODE_201) { 

       List<RatingsDetail> getRatingDetails = response.body().getAndroid().getRatingsDetails(); 
       List<CourseDetail> getCourseDetail = response.body().getAndroid().getCoursedetails(); 
       String getratingcouts = response.body().getAndroid().getRatingsCounts().getMembercount(); 
       String gettotcount=response.body().getAndroid().getRatingsCounts().getTotalrating(); 
       int getcalc=response.body().getAndroid().getRatingsCounts().getCalculation(); 
       Bundle bundle = new Bundle(); 
       bundle.putSerializable("RatingDetails", (Serializable) getRatingDetails); 
       bundle.putSerializable("CourseDetails", (Serializable) getCourseDetail); 
       bundle.putString("getembercount",getratingcouts); 
       bundle.putString("gettotcount",gettotcount); 
       bundle.putInt("gettotcount",getcalc); 
       Intent intent = new Intent(context, CourseDetailActivity.class); 
       intent.putExtras(bundle); 
       intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); 
       context.startActivity(intent); 


      } 
     } 

     @Override 
     public void onFailure(Call<Example> call, Throwable t) { 
      Log.i("ttttttttt", "" + t); 
      call.cancel(); 
     } 

    }); 

} 
関連する問題