retrofit

Android Retrofit simple usage error

自闭症网瘾萝莉.ら 提交于 2019-12-24 16:27:50
问题 Reused some come from tutorial to get Retrofit working. These are the key classes. MainActivity package com.example.jc.retrofittest; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; import com.example.jc.retrofittest.POJO.Model; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; public class MainActivity extends AppCompatActivity { TextView city, status, humidity,

Retrofit + rxJava: how to implement iterable N requests?

為{幸葍}努か 提交于 2019-12-24 15:56:40
问题 I have a problem to implement following problem: I'm making a request that fetches all active leagues. Then, for each of them I need to make another request to grab the matches. I think it's possible to implement the solution using flatMapIterable, but don't know how. For now I have following retrofit interfaces: public interface LeaguesApi { @GET("/api/get-leagues") Observable<ArrayList<League>> getLeagues(@Query("active_only") boolean activeOnly); } public interface LeagueApi { @GET("/api

response.isSuccess == true but file not send

半世苍凉 提交于 2019-12-24 14:09:53
问题 I'm trying to upload a file from my app using Retrofit to a server. Everything is almost alright and the response.isSuccess equals true, but the file is not sent. I first present my code and then I mention some results that I have used for tracing the work flow. public class MainActivity extends Activity { private static int RESULT_LOAD_VIDEO = 1; String decodableString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

How to Handle JsonSyntaxException when Receiving Response from GAE

徘徊边缘 提交于 2019-12-24 13:54:56
问题 I am trying to replicate the Google App Engine Servlets module here using Retrofit instead of AsyncTask. I find it odd, but apparently Retrofit 2.0 does not support connections to Google App Engine, as stated here in the issues of the GitHub repository. As a result, I am using Retrofit 1.9 and OkHttp 2.3 dependencies. I have created a project called "Retrofit Test" in the Google Developer Console, and Google has supplied me with a URL for the project: "http://retrofit-test-1203.appspot.com"

Gson/Retrofit parse variable JSON

岁酱吖の 提交于 2019-12-24 12:45:28
问题 I'm struggling in parsing a JSON Object with variable content to a Java Object. Normally, I'd try to map a JSON Object to a POJO, however in this case I don't know what to do. My JSON looks like this: "parts": [ [ "text", "http://www.example.com/" ], [ "page", [ "http://www.example.com/", "\n\t\n\t\t\n\t\t\tSome of the Page Content preview here...", "", "/path/to/picture.jpg" ] ], [ "text", "Another String here " ] ] Running this piece of code trough a typical Json to Java Object converter

Retrofit: Post raw text “user={”key1“: ”value1", etc.}?

两盒软妹~` 提交于 2019-12-24 11:28:46
问题 So I am pretty new on that library (Retrofit) and actually I am stucked on an atypical case. I have an API where I try to register (sign up) a new user to it, to test it I use "DHC Rest Client" on Chrome. It works when I send this (see below): Header: Content-Type: application/x-www-form-urlencoded Body (text) user={"key1": "value1", "key2": "value2", etc.} So my plan is to make the same thing on Android ! I have created an interface (see below): Interface interface RestRegister{ @Headers(

How to solve java.io.EOFException: End of input at line 1 column 1 path 1 in retrofit service call in android?

岁酱吖の 提交于 2019-12-24 10:45:02
问题 I am new to android. I am not getting why this error is coming. Error : java.io.EOFException: End of input at line 1 column 1 path $ W/System.err:at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1393) Please help. This is my code : 1. Pojo class ProfileEntity implements Parcelable { @SerializedName("tag") @Expose private String tag; @SerializedName("success") @Expose private Integer success; @SerializedName("error") @Expose private Integer error; @SerializedName(

Parse Dynamic unknown named array Json using Retrofit

戏子无情 提交于 2019-12-24 10:18:37
问题 i'm new to retrofit,below is the json { "response": "success", "servicecode": "134", "forecast": { "month": { "jan": [ { "id": "1", "price": "12", "Product": "1086", "Qty": "14", "date": "2018-10-27 16:08:57" }, { "id": "2", "price": "19", "Product": "1746", "Qty": "45", "date": "2018-10-27 16:08:57" } ], "april": [ { "id": "3", "price": "89", "Product": "1986", "Qty": "15", "date": "2018-10-27 16:08:57" }, { "id": "1", "price": "12", "Product": "1086", "Qty": "145", "date": "2018-10-27 16:08

how to fix “500 internal server error in retrofit and web services” in asp.net web method [closed]

ぐ巨炮叔叔 提交于 2019-12-24 08:28:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . I am trying to insert the record using asp.net web-services from the android platform using retrofit. I have already tried many solutions but not able to get success. Basically in my asp.net web service code is: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public void insertEducationAPI(int

Android Retrofit 2.0 JSON document was not fully consumed

守給你的承諾、 提交于 2019-12-24 08:28:39
问题 I am using retrofit 2.0 to post data in the form of post request with pojo class and returning string as an response either failure or success and now the problem is that it says json cannot be consumed. compile 'com.squareup.retrofit:retrofit:2.0.0-beta2' compile 'com.google.code.gson:gson:2.6.1' compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' compile 'com.squareup.okhttp:okhttp:2.4.0 Now I am trying to post jsonobect as like below. My pojo class is as below public class