retrofit

Retrofit 2 disable encoding for post parameters

牧云@^-^@ 提交于 2021-01-27 04:09:22
问题 I am beginner in retrofit... I need send POST request with simple parameters name : value login[name] : some-name login[pw] : some-pw date : 2017-08-28T12:12:12+0200 so, I tried @FormUrlEncoded @POST(urlLogin) Call<Login> signIn(@Field("login[name]") String name, @Field("login[pw]") String pw, @Field("date") String date); that send to the server: login%5Bname%5D : some-name login%5Bpw%5D : some-pw date : 2017-08-28T21%3A11%3A57%2B0200 next @FormUrlEncoded @POST(urlLogin) Call<Login> signIn(

Android Retrofit Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

孤街醉人 提交于 2021-01-26 19:33:16
问题 I am using okhttp Retrofit in my Android App to make network requests. On one of the requests I get this error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ I see a 201 response in the logs but Retrofit throws this error. Below is my code. signup(signupParams, new Callback<Member>() { @Override public void success(Member member, Response response) { if (member != null) { UserAccount userAccount = new

Android Retrofit Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

為{幸葍}努か 提交于 2021-01-26 19:29:24
问题 I am using okhttp Retrofit in my Android App to make network requests. On one of the requests I get this error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ I see a 201 response in the logs but Retrofit throws this error. Below is my code. signup(signupParams, new Callback<Member>() { @Override public void success(Member member, Response response) { if (member != null) { UserAccount userAccount = new

Android Retrofit Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

萝らか妹 提交于 2021-01-26 19:28:16
问题 I am using okhttp Retrofit in my Android App to make network requests. On one of the requests I get this error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ I see a 201 response in the logs but Retrofit throws this error. Below is my code. signup(signupParams, new Callback<Member>() { @Override public void success(Member member, Response response) { if (member != null) { UserAccount userAccount = new

Android Retrofit Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

[亡魂溺海] 提交于 2021-01-26 19:26:08
问题 I am using okhttp Retrofit in my Android App to make network requests. On one of the requests I get this error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $ I see a 201 response in the logs but Retrofit throws this error. Below is my code. signup(signupParams, new Callback<Member>() { @Override public void success(Member member, Response response) { if (member != null) { UserAccount userAccount = new

小鹿端午节来发福利了

喜夏-厌秋 提交于 2021-01-24 12:34:58
端午节福利来一波 今天是端午节,祝大家端午节快乐,与此同时「小鹿」恭喜五位读者获得端午节福利。 还记得前天发的那篇福利文章吗?经过我一天的筛选和统计观察,选出了一位读者赠送计算机书籍一本。邮费需要自己出哦!其他四位中奖用户可获得小鹿最珍贵的「 Android Okhttp / Retrofit 源代码解析视频」一部『二选一』。 很感谢前天各位读者对小鹿的打赏认可。第一次开打赏,让我很吃惊的是,这仅仅 100 「我很少推广我公众号的,就是为了保证关注读者的质量」多个关注中忠实读者超出了我预测的范围,让我高兴了一晚上。除了中奖用户外,我决定其他打赏读者可以加我微信,每人发一部电子版的『Android高薪之路: Android 程序员面试宝典』,电子版内容我都看过。等你看了之后,相信你会爱上它的。 中奖用户如下: ① 溺水三千 ② 坤哥、Lin_Sss_航、叶落、可达鸭和呆河马。 ③其他打赏用户即可获取精华电子书一部。 领取方式:中奖用户加我微信『备注:领取福利』即可获取。 说说这次发福利的感受 我开打赏之前说过,打赏金额不重要,重要的是对小鹿的一份认可。之前也说过,你在我这里学习到的也多可以多打赏点,学的少可以少打赏,学不到东西可以不打赏。确实有一两个读者打赏的挺多的,我猜这几个读者确实在文章中能够吸取自己想要的精髓。还需要各位读者多多领悟,有些东西我不能写的太过于详细

Dynamic Multiple json Array in Android Retrofit 2

空扰寡人 提交于 2021-01-21 12:01:26
问题 In the json below i am able to read the fields in " categories " using the following android code. I hava no idea how to read the "effect_list" elements "4" and "1" . The "4" and "1" are incremental and Dynamic . How should i create a pojo class for this and how my code should be in Main_get.java ? { "categories":[ { "mcategory_id":"4", "mcategory_name":"Band" }, { "mcategory_id":"1", "mcategory_name":"Basic Effects" }, { "mcategory_id":"3", "mcategory_name":"Bg Image Card" } ], "effect_list"

Dynamic Multiple json Array in Android Retrofit 2

三世轮回 提交于 2021-01-21 12:00:30
问题 In the json below i am able to read the fields in " categories " using the following android code. I hava no idea how to read the "effect_list" elements "4" and "1" . The "4" and "1" are incremental and Dynamic . How should i create a pojo class for this and how my code should be in Main_get.java ? { "categories":[ { "mcategory_id":"4", "mcategory_name":"Band" }, { "mcategory_id":"1", "mcategory_name":"Basic Effects" }, { "mcategory_id":"3", "mcategory_name":"Bg Image Card" } ], "effect_list"

Retrofit 2: How to set individual timeouts on specific requests?

自作多情 提交于 2021-01-21 03:37:19
问题 I have set a global timeout in my Retrofit adapter by doing OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setReadTimeout(20, TimeUnit.SECONDS); okHttpClient.setConnectTimeout(20, TimeUnit.SECONDS); retrofit = new Retrofit.Builder() .client(okHttpClient) .build(); Great! But I would like to set an specific timeout for certain requests E.g. public interface MyAPI { @GET() Call<Void> notImportant (@Url String url); @GET Call<Void> veryImportant(@Url String url); So veryImportant

Retrofit 2: How to set individual timeouts on specific requests?

会有一股神秘感。 提交于 2021-01-21 03:33:54
问题 I have set a global timeout in my Retrofit adapter by doing OkHttpClient okHttpClient = new OkHttpClient(); okHttpClient.setReadTimeout(20, TimeUnit.SECONDS); okHttpClient.setConnectTimeout(20, TimeUnit.SECONDS); retrofit = new Retrofit.Builder() .client(okHttpClient) .build(); Great! But I would like to set an specific timeout for certain requests E.g. public interface MyAPI { @GET() Call<Void> notImportant (@Url String url); @GET Call<Void> veryImportant(@Url String url); So veryImportant