retrofit2

Callback onResponse and onFailure not called (retrofit2)

核能气质少年 提交于 2020-01-06 05:36:47
问题 I have a cursor which is an id to get the next set of results from server, and i tried adding a do while loop until cursor value reaches 0 (end of results), i realised onResponse and onFailure callback methods are not called once i added the do while loop so the cursor is stuck at initial value without reaching 0 ( fetchResults from the api are not called). The loadTwitterFriends keeps getting called and it resulted in an infinite do while loop. Can i know why the callback methods aren't

retrofit error Expected BEGIN_ARRAY but was BEGIN_OBJECT

ⅰ亾dé卋堺 提交于 2020-01-06 05:24:16
问题 I try to get Otp using mobile number, but it display error like this E/FAILISJERE: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 54 path $.data This is my URL := http://192.168.1.105/XXXX/XXXXX/XXXXX/default/send-otp Request Fields: mobileNo,name Response is like this :- { "error": false, "msg": "Otp sent successfully", "data": { "otp": 152265 } } APIClient.Kt:- object ApiClient { private var retrofit: Retrofit? = null val client: Retrofit get() {

How to return FilterResults in AutoCompleteTextView Adapter consuming ApiRest with RxJava or Retrofit2?

那年仲夏 提交于 2020-01-06 04:42:30
问题 I am coding an autocompleteTextView adapter which is filled by an ApiRest. I'm using rxJava and Retrofit 2. but cannot get the filtered result because i dont know how to return the value in asynchronous function. here is my code public class DiagnosticoAutoCompleteAdapter extends BaseAdapter implements Filterable { ... @Override public Filter getFilter() { Filter filter = new Filter() { @Override protected FilterResults performFiltering(CharSequence charSequence) { final FilterResults

Handle JSON response with multiple type of the same name

主宰稳场 提交于 2020-01-06 04:42:18
问题 The JSON response is : { "success": false, "errorMessages": [ "You have to select a maximum load of <span style='color:red;'>0</span> Credit/Course but you have selected <span style='color:red;'>3</span> Credit/Course --- [R060]", "You can register courses as a full study with a load limit between <span style='color:red;'>12</span> and <span style='color:red;'>18</span> Credit/Course, but you have selected <span style='color:red;'>9</span> Credit/Course --- [R062]" ], "isConflict": 0 } but

Retrofit 2 beta-4. Android 6. Unable to create convertor

孤人 提交于 2020-01-05 11:02:58
问题 How to fix it? Process: www.palchiki.com.palchiki, PID: 2047 java.lang.IllegalArgumentException: Unable to create converter for class www.palchiki.com.palchiki.model.ServiceResponse for method APIWebService.getServices at retrofit2.Utils.methodError(Utils.java:154) at retrofit2.MethodHandler.createResponseConverter(MethodHandler.java:62) at retrofit2.MethodHandler.create(MethodHandler.java:33) at retrofit2.Retrofit.loadMethodHandler(Retrofit.java:164) at retrofit2.Retrofit$1.invoke(Retrofit

How to post request and get response with retrofit 2?

我只是一个虾纸丫 提交于 2020-01-05 07:41:37
问题 My service just use post method. in my code : my ApiInterFace Class public interface ApiInterface { @POST("srrvk") @FormUrlEncoded Call<JoinAllAllowedInnoResponse> GETJOINALLOWEDINNOLIST(@Field("a") Integer lastOrderId, @Field("b") Integer rowCount,@Header("wkey") String wkey); } and my getArrayList method is like public void getJoinlist(Integer lastOrderId,Integer rowCount){ showProgressDialog("Please Wait..."); final String wkey = tinyDB.getString(Constant.wkey); Log.d(CLASS_NAME, "wkey :"

how to display image from <img src> html tags from api?

戏子无情 提交于 2020-01-05 07:09:28
问题 I have used holder.txtTitle.setText(HtmlCompat.fromHtml(dataList.getDescription(), 0)); HtmlCompat.fromHtml removed tags but didn't displayed image I'm getting something like this how to display the entire image instead of the box? because HtmlCompat.fromHtml didn't work. thanks in advance HTML text(from API): <p>Android is a Linux based operating system it is designed primarily for touch screen mobile devices such as smart phones and tablet computers. The operating system have developed a

How do I inject an abstraction using an IOC container like Dagger 2

别等时光非礼了梦想. 提交于 2020-01-05 05:55:22
问题 What I would like to do is to have an abstraction, and pass the abstraction as parameter. So that if one day something better than retrofit comes along and I want to switch it, it will be easy to do so. Although I have no idea on how do it. Here is a basic overview of what I want to do: public interface ApiClient{ Object getClient() } public class RetrofitClient implements ApiClient{ private static Retrofit retrofit = null; @Override public Retrofit getClient(){ if(retrofit == null){

How do I inject an abstraction using an IOC container like Dagger 2

前提是你 提交于 2020-01-05 05:54:23
问题 What I would like to do is to have an abstraction, and pass the abstraction as parameter. So that if one day something better than retrofit comes along and I want to switch it, it will be easy to do so. Although I have no idea on how do it. Here is a basic overview of what I want to do: public interface ApiClient{ Object getClient() } public class RetrofitClient implements ApiClient{ private static Retrofit retrofit = null; @Override public Retrofit getClient(){ if(retrofit == null){

Sending Multipart data using Retrofit

柔情痞子 提交于 2020-01-05 05:41:09
问题 Interface public interface iUpload{ @Multipart @POST("/uploadmultiplepropimages/") SamplePojoClass getUploadData( @Part("prop_id") RequestBody prop_id, @Part("type") RequestBody type, @Part("prop_photos") TypedFile prop_photos ); } I'm sending like this. I cant send request body text like this. @Override protected Void doInBackground(String... params) { String s = params[0]; File photoFile = new File(s); System.out.println("file path:"+photoFile); TypedFile photoTypedFile = new TypedFile(