retrofit2

how do i post Long encoded string of base64 image to server using retrofit?

可紊 提交于 2020-08-17 12:18:44
问题 i'm trying to post encoded string of image to retrofit post method...after debugging i got very long string on debug of image chosen from gallery.....after submitting i can see long string encoded of image in debugger....in postman when i check i shows profile_pic: " " that is null ... need help if i used endpoint like this im not getting crash: @FormUrlEncoded @POST("update") fun useredit( @Header("access_token") token: String, @Field("first_name") first_name:String, @Field("last_name") last

How should I fetch images under an array using retrofit

∥☆過路亽.° 提交于 2020-08-15 05:54:06
问题 I have images under array...here is my json: { "status": 200, "data": { "id": 1, "product_category_id": 1, "name": "Centre Coffee Table", "producer": "Luna", "description": "Mild Steel Base In Poder Coated White Finish.8 mm Tempered Glass Table Top.Bottom Shelf In Paimted Brown Glass.", "cost": 5000, "rating": 3, "view_count": 21243, "created": "2015-09-07T09:24:05+0000", "modified": "2020-07-27T10:52:42+0000", "product_images": [ { "id": 1, "product_id": 1, "image": "http://staging.php-dev

Getting json from retrofit's response errorBody

半世苍凉 提交于 2020-08-01 06:28:20
问题 I am struggling with retrofit. When I post a request in my browser i get such a request: And that's what I expect. However, when I try to parse this in my app I kept getting responses as in this thread. I've found tried to implement this solution, but my errorBody does not even resemble the answer from my browser: How can I get this JSON? Just in case this is my response handler code: void handleResponse(Response response){ TextView textView = (TextView)findViewById(R.id.empty_list_tv); if

Getting json from retrofit's response errorBody

早过忘川 提交于 2020-08-01 06:28:11
问题 I am struggling with retrofit. When I post a request in my browser i get such a request: And that's what I expect. However, when I try to parse this in my app I kept getting responses as in this thread. I've found tried to implement this solution, but my errorBody does not even resemble the answer from my browser: How can I get this JSON? Just in case this is my response handler code: void handleResponse(Response response){ TextView textView = (TextView)findViewById(R.id.empty_list_tv); if

datepicker value from edittext using Retrofit post request

烂漫一生 提交于 2020-07-31 04:16:10
问题 im using retrofit post request method to post date from edittext(date retrieved from datepicker)...when i select date from datepicker and select date on it..it is displaying right date on edittext...but when i submit and check on postman it is showing wrong date.. need help thanks following is my code: val myCalendar: Calendar = Calendar.getInstance() val edittext1 = findViewById(R.id.dob) as EditText val date = OnDateSetListener { view, year, monthOfYear, dayOfMonth -> // TODO Auto-generated

How to handle retrofit socket timeout for uploading files in android kotlin?

Deadly 提交于 2020-07-23 08:37:18
问题 var client = OkHttpClient() val builder = OkHttpClient.Builder() val gson = GsonBuilder() .setLenient() .create() builder.addInterceptor(AddCookiesInterceptor(mcontext)) builder.addInterceptor(ReceivedCookiesInterceptor(mcontext)) builder.callTimeout(100,TimeUnit.SECONDS) client = builder.build() retrofit = Retrofit.Builder() .baseUrl(BASE_URL) .client(client) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .addConverterFactory

How to handle retrofit socket timeout for uploading files in android kotlin?

强颜欢笑 提交于 2020-07-23 08:36:11
问题 var client = OkHttpClient() val builder = OkHttpClient.Builder() val gson = GsonBuilder() .setLenient() .create() builder.addInterceptor(AddCookiesInterceptor(mcontext)) builder.addInterceptor(ReceivedCookiesInterceptor(mcontext)) builder.callTimeout(100,TimeUnit.SECONDS) client = builder.build() retrofit = Retrofit.Builder() .baseUrl(BASE_URL) .client(client) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .addConverterFactory

How to handle retrofit socket timeout for uploading files in android kotlin?

送分小仙女□ 提交于 2020-07-23 08:35:14
问题 var client = OkHttpClient() val builder = OkHttpClient.Builder() val gson = GsonBuilder() .setLenient() .create() builder.addInterceptor(AddCookiesInterceptor(mcontext)) builder.addInterceptor(ReceivedCookiesInterceptor(mcontext)) builder.callTimeout(100,TimeUnit.SECONDS) client = builder.build() retrofit = Retrofit.Builder() .baseUrl(BASE_URL) .client(client) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .addConverterFactory

API declarations must be interfaces- Retrofit

喜你入骨 提交于 2020-07-20 11:58:30
问题 I am try to do simple get response using Retrofit . And i have error java.lang.IllegalArgumentException: API declarations must be interfaces. . I can not figure out what exactly the problem. I have this error when i try to do CategoryJsonParser categoryParsed = retrofit.create(CategoryJsonParser.class); . So its my interface: public interface InterfaceForCategory { @GET("categories?api_key=l6pdqjuf7hdf97h1yvzadfce") Call<List<CategoryJsonParser>> getData(); } How i create retrofit in main act

API declarations must be interfaces- Retrofit

早过忘川 提交于 2020-07-20 11:58:28
问题 I am try to do simple get response using Retrofit . And i have error java.lang.IllegalArgumentException: API declarations must be interfaces. . I can not figure out what exactly the problem. I have this error when i try to do CategoryJsonParser categoryParsed = retrofit.create(CategoryJsonParser.class); . So its my interface: public interface InterfaceForCategory { @GET("categories?api_key=l6pdqjuf7hdf97h1yvzadfce") Call<List<CategoryJsonParser>> getData(); } How i create retrofit in main act