retrofit

ValueRequiredException during RSS feed parsing in Retrofit

只愿长相守 提交于 2019-12-25 06:21:47
问题 I'm trying to write a simple RSS reader app for Android. I'm using Retrofit for network communication with SimpleXMLConverter to populate POJOs from XML. This is my REST API: package ru.unatco.rss.data; import java.util.List; import retrofit.Callback; import retrofit.http.GET; public interface RssAdapter { @GET("/radio-t") void getItems(Callback<RadioTItems> callback); } This is the code that calls API: RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint("http://feeds.rucast.net"

Unable to send raw json data in post api data using Retrofit 2.0

烂漫一生 提交于 2019-12-25 04:24:55
问题 Unable to send raw JSON data in POST api data using Retrofit 2.0 try { JSONObject myUserData = new JSONObject(); myUserData.put("mobile", "917023847899"); myUserData.put("displayName", "Deepuu"); myUserData.put("info", "AD"); myUserData.put("photo", ""); myUserData.put("displayName", "Deepu"); JSONObject deviceData = new JSONObject(); ; deviceData.put("deviceId", "2124578910556991"); deviceData.put("pnToken", "klklklkl"); deviceData.put("os", "android"); deviceData.put("targetTopic",

How get JSON Object with Retrofit 2 and Android Studio?

大憨熊 提交于 2019-12-25 03:53:53
问题 I am making an application in Android Studio and I want to consume API for cooking recipes, I have the following response from the API that I am consuming with Android Studio and Java: API Response "q" : "pollo", "from" : 0, "to" : 10, "params" : { "sane" : [ ], "q" : [ "pollo" ], "app_id" : [ "02" ], "app_key" : [ "\n66b" ] }, "more" : true, "count" : 1000, "hits" : [ { "recipe" : { "uri" : "http://www.edamam.com/ontologies/edamam.owl#recipe_d56f75c72ab67a45174441af1efe4473", "label" :

Trying to get Retrofit onResponse executed first

夙愿已清 提交于 2019-12-25 03:45:48
问题 My list in my activity called AllStores contains only null. I need this list, because I want to populate my ListView later on. The problem is caused because my callback is getting executed as last. To clarify I have made a screenshot below: Link: http://i.imgur.com/bIkWjld.png The screenshot also tells what I actually want. To achieve that I had tried it with a AsyncTask . However it didn't worked out as you can see in the screenshot. Here is the code: EDIT 2.0 I have changed my getSubprise()

Kapt NonExistentClass exception in a Retrofit interface after migrating to androidX

早过忘川 提交于 2019-12-25 02:32:54
问题 I am using Retrofit , Dagger and Glide for my app. After migrating to androidX , kapt works perfectly with Dagger and Glide annotation processors. The projects build and syncs successfully, however, when I run the app, I get Kotlin compiler exceptions in my ApiService interface, where I use Retrofit annotations ApiService.kt import retrofit2.Call import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import retrofit2.http.GET import retrofit2.http.POST import retrofit2

Is it possible to show a chart by using MpAndroid from web server api?

☆樱花仙子☆ 提交于 2019-12-25 01:33:41
问题 I am newbie android developer and i have a list of different currency items and I should open a new screen with chart of clicked item. when user clicks on a list item a new screen should be opened which shows the exchange rate chart of the selected currency for the last 7 days based on USD. I should request every time the currency data gets updated for the last 7 days. Example request for getting currency history in a given period between USD and CAD: https://api.exchangeratesapi.io/history

Retrofit Sending Json

半世苍凉 提交于 2019-12-25 01:05:07
问题 I need to send a Json to a payment gateway through Retrofit. I really do not know what I have badly tested postman and everything works well. when trying to adapt with retrofit I only get null as a response. My class Utils public class ApiUtils { private ApiUtils() {} public static final String BASE_URL = "https://api.payulatam.com/"; public static APIService getAPIService() { return RetrofitClient.getClient(BASE_URL).create(APIService.class); } } My interface Class public interface

Android: How to retain the errorBody() in retrofit response?

a 夏天 提交于 2019-12-24 21:42:40
问题 I want to get the errorBody's error message, which I do by calling errorBody().string() (tried with errorbody().byteStream() too). But no matter what, after reading it out, the response errorbody's message will be null. It's not an option to save out the string to a static variable, but the project requires to check the response multiple times in different scenarios. My question is how to get the errorBody's message without clearing it out? 回答1: errorBody is of type ResponseBody is from

Retrofit Android: Method invocation 'getSuccess' may produce 'java.lang.NullPointerException'

一笑奈何 提交于 2019-12-24 19:18:34
问题 I am using Retroft and GSON for parsing the response. My onResponse code is like below @Override public void onResponse(@NonNull Call<ResultList> call, @NonNull Response<ResultList> response) { if (response.isSuccessful()) { if (response.body() != null && response.body().getSuccess() == 1) { ................ I am checking response.body() != null and also response.isSuccessful() . Still I am getting warning in Android studio on line response.body().getSuccess() . How to avoid this warning? I

Make a GET and POST service call with Retrofit with the use of Protobuf (Protocol Buffer)

走远了吗. 提交于 2019-12-24 17:22:42
问题 Can anyone please give me some example how we can use protobuf in retrofit - I tried but its failed with some error , let me give you a sample of my implementation on that. I hope you guys will help me. ApiInterface.java public interface ApiInterface { @GET Call<CommonProto.Country> makeGetRequest(@Url String url); } ApiClient.java public class ApiClient { public static final String BASE_URL = "**************************"; private static Retrofit retrofit = null; public static Retrofit