2017-10-05 5 views
0

retrofit2를 사용하여 네트워크 호출을하고 데이터를 얻습니다. 이 링크 이제Regarading retrofit 2

https://square.github.io/retrofit/2.x/retrofit/index.html?retrofit2/Callback.html

Callback methods are executed using the Retrofit callback executor. When none is specified, the following defaults are used: 

Android: Callbacks are executed on the application's main (UI) thread. 
JVM: Callbacks are executed on the background thread which performed the request. 

우리가 콜백의 유형을 지정할 수 있습니다 retrofit2 요청을하는 방법을 실행하기 위해 통화 중 어떤 방법이를 참조

가 사용되는?

감사합니다.

+0

이 정보는 https://stackoverflow.com/a/33384551/7689086에서 찾을 수 있습니다. –

답변

0

사용할 콜백 유형을 지정할 필요가 없습니다. 두 경우 모두 일반 콜백 만 사용하십시오.

당신이 콜백은 UI 스레드에서 실행하려면

, 그냥 그렇지 않으면 onResponse 방법 내부에 AsyncTask을 놓고 onResponse 방법 내부 코드를 배치합니다.

관련 문제