retrofit2

androidx.paging.PagedStorage.init is giving error when proguard is enabled

梦想的初衷 提交于 2020-01-23 19:01:25
问题 I'm using retrofit with okhttp and migrated to AndroidX, When I make a signed app that obfuscated with proguard it crashes and gives an error,but in debug mode when proguard is not enabled it's working good. and I disabled proguard just for testing and made a signed APK it's working this way too. so I'm sure the crash is caused by Proguard. And I did some search on google they all say that I have to add proguard rules for both OKHTTP and Retrofit I did add them too but it still crashes. The

Retrofit2 return null Unit in kotlin for 204 No Content response

风流意气都作罢 提交于 2020-01-23 08:37:47
问题 I'm using Retrofit 2.0.2 to post data to server using the interface below: @POST("/path/to/post") fun postData(/*args*/): Observable<Unit> And received success response from server. 05-09 21:20:21.770 23117 23224 D OkHttp : --> POST https://myserver.com/api/notifications/123/markRead http/1.1 05-09 21:20:21.770 23117 23224 D OkHttp : Content-Length: 0 05-09 21:20:21.770 23117 23224 D OkHttp : User-Agent: MyUserAgent 05-09 21:20:21.770 23117 23224 D OkHttp : Authorization: Bearer xxxxx 05-09

Retrofit: Unable to create @Body converter for class

依然范特西╮ 提交于 2020-01-22 17:54:05
问题 I need to send next json via retrofit 2: { "Inspection": { "UUID": "name", "ModifiedTime": "2016-03-09T01:13", "CreatedTime": "2016-03-09T01:13", "ReviewedWith": "name2", "Type": 1, "Project": { "Id": 41 }, "ActionTypes": [1] } } With Header: Authorization: access_token_value I tried this: //header parameter String accessToken = Requests.getAccessToken(); JsonObject obj = new JsonObject(); JsonObject inspection = new JsonObject(); inspection.addProperty("UUID","name"); inspection.addProperty(

particular title(fetched from api) using searchview?

瘦欲@ 提交于 2020-01-18 10:48:26
问题 I want something like this---> Required so the thing is, what I exactly want is when user type particular topic name(if present in-app) in searchview it should able give suggestions and if found it should open that topic activity ( just like Facebook, Instagram,...etc searches )..and those title are coming from API(which I have successfully displayed in other activities)..like this--> [enter image description here..what will the logic for it??? need help... Thanks so I have just included

No such file or diectory error in image file upload using Retrofit in Android

懵懂的女人 提交于 2020-01-17 07:21:09
问题 I am developing an Android app. In my app, I am using Retrofit to upload image and pdf files to server in multipart/form-data request. I am new to Retrofit. I uploaded pdf file and other string data successfully. But when I upload Image file, it is giving me "No such file or directory" exception even I did the same thing as PDF file that is successfully uploaded. This is my activity upload pdf file and image file public class ContributeActivity extends AppCompatActivity { public static final

No such file or diectory error in image file upload using Retrofit in Android

陌路散爱 提交于 2020-01-17 07:21:06
问题 I am developing an Android app. In my app, I am using Retrofit to upload image and pdf files to server in multipart/form-data request. I am new to Retrofit. I uploaded pdf file and other string data successfully. But when I upload Image file, it is giving me "No such file or directory" exception even I did the same thing as PDF file that is successfully uploaded. This is my activity upload pdf file and image file public class ContributeActivity extends AppCompatActivity { public static final

Retrofit Query Annotation Without Ampersand

风格不统一 提交于 2020-01-17 05:28:10
问题 I am trying to make an API call to a mobile backend with Retrofit 2.0. In my API call, i have to make necessary call to this URL https://api.backendless.com/v1/data/Users?where=followings.objectId=%270B3BA7F9-260F-B378-FF9A-3C2448B8A700%27 To form this URL in Retrofit i have been using below interface @GET("Users?where=") Call<List<User>> getFollowers(@Query("followings.objectId") String objectId); This interface call puts an ampersand before the query parameters and generates a URL like

fetching data from innermost class using Retrofit. Help me to display data of classes A and B

二次信任 提交于 2020-01-17 05:06:51
问题 The following is the JSON I was trying to fetch data from. I need to extract and display names and class using retrofit2. 3.I tried several sites, but only able to fetch data directly from an array 4.But not from an array of objects. That would be formed by this code. { "Class1" :{ "A": [ { "name" : "paul", "class" : "first" } ], "B": [ { "name" : "anna", "class" : "second" } ] }, "Class2" :{ "A": [ { "name" : "matthew", "class" : "first" } ], "B": [ { "name" : "joe", "class" : "second" } ] }

How to resize an image after selecting it from the gallery?

拜拜、爱过 提交于 2020-01-16 16:25:55
问题 In my application I want select image from gallery or capture image from camera and upload to server. I want before send to server first resize this image with this size : 1000 x 600 then upload this. My codes: public class ImageActivity extends AppCompatActivity implements View.OnClickListener { ImageView imageView; Button pickImage, upload; private static final int REQUEST_TAKE_PHOTO = 0; private static final int REQUEST_PICK_PHOTO = 2; private Uri mMediaUri; private static final int CAMERA

Retrofit is not working below Lollipop

扶醉桌前 提交于 2020-01-16 15:47:06
问题 I am trying to get data from my website using Retrofit . It's working fine from Android 5.0 but lesser android version showing error message Connection closed by peer . Here is my code... Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://myWebsite.com/api/") .addConverterFactory(GsonConverterFactory.create()) .build(); service = retrofit.create(MyService.class); And here is MyService class @GET Call<CategoryResponse> getCategoryResponse(@Url String url); What am I missing here? It