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  )


3rd Open JSON 2 POJO   URL (ex: JSON  2 POJO class  ) and paste all JSON text/content and
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.  

Step 5: 

Step 6: 

Step 1: 


















মন্তব্যসমূহ

এই ব্লগটি থেকে জনপ্রিয় পোস্টগুলি

API (Application Programming Interface) .

Add Gif file in Android xml file