Android Jetpack

Retrofit - 2 (Simple Retrofit Example)

개복치 개발자 2022. 2. 7. 23:43

 개복치개발자 강의는 아래의 링크에서 확인할 수 있습니다.

 

개복치개발자 | Linktree

uyalae@naver.com

linktr.ee

 

 간단한 Retrofit 예제를 한번 해보도록 하겠습니다.

 

 우선적으로 gradle에 implementation을 해줍니다.

 

<uses-permission android:name="android.permission.INTERNET"/>
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

    

 폴더 구조는 아래와 같고

  

 코드는 아래와 같습니다.

 

 

 

 

  

 

 다음 글에서 Retrofit + Livedata + ViewModel + Coroutine을 이용해서 한번 해보겠습니다.