Android Retrofit Library
Android Retrofit Library
JSON Example for use
==================================================================
Step 1:
Open An Android Project First 😅😅
2nd Open JSON Schema (Online) and copy all the JSON file. (ex: Yahoo Weather API )
Then copy and paste Package Name from your Project.
Choose JSON to GSON then click preview or Zip...
then Download the Zip file by clicking Example source.zip.
Step 2:
we need 3 Library Dependencies:-
go to :- file -> project structure -> app -> dependencies -> + -> 1 library depency
now search: retrofit2, Picasso, GSON
or simply Add this 3 dependencies as below:-
compile 'com.squareup.retrofit2:retrofit:2.2.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.squareup.retrofit2:converter-gson:2.2.0'
Step 3:
Now UnZip the Example source.zip and Copy All the Class into your android project.
[Note: if you do step 3 before step 2 then you can get some error in ]
Step 4:
Now, define Full_url & Base_URL ;
a) Make an interface .... [ here... WeatherApi.java ]
b) in that interface make object of the first/Main Class. [ here: Example.java ] . cause here the total data going to store first ... as the total query.
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন