retrofit

how do I implement progress bar outside of the recycle view activity?

限于喜欢 提交于 2020-01-03 03:44:08
问题 I want to display something like this-->My Home activity..inside Whats Android,Start learning ,Get ahead there are recycleviews like this-->enter image description here..... how do I implement this kind of progressbar based upon users reading?? need help..thanks My Home activity: public class MainActivity extends AppCompatActivity { private RecyclerView recyclerview ; private String[] names ; private TypedArray profile_pics ; private TypedArray card_images; ImageView imageView; private List

Android retrofit converter exception

别来无恙 提交于 2020-01-02 18:56:10
问题 How to format/design your class if you can get 2 different response request from the server? Note: Retrofit will thrown an Exception if the JSON response format (design) is different with your class. All fields from JSON response must be present in your class. Java class, like JSON response: public class RequestResponseLogin { public ResponseLogin status; public class ResponseLogin { public boolean success; public List<String> message; } } The JSON response: { "status" : { "success" : false

Retrofit 2 simple upload file to server

吃可爱长大的小学妹 提交于 2020-01-02 17:56:30
问题 i'm newbie in retrofit and in this code i want to upload file as an image or other format to server, i read Retrofit document about that, but i can't do that, i can create provider and i can use that to POST or GET from server, but my problem is for that is upload file. Thanks to advance My SignalProvider class: public class SignalProvider { private SignalRetrofitServiceProviders signalRetrofitServiceProviders; public SignalProvider(){ OkHttpClient httpClient = new OkHttpClient(); Retrofit

Square Retrofit Client: How to enable/disable followRedirects? How to intercept redirect URL?

大憨熊 提交于 2020-01-02 03:10:14
问题 I'm using Square's Retrofit Client to make simple requests from an Android App. Like so: RestAdapter restAdapter = new RestAdapter.Builder() .setServer(Configurations.getInstance().plistMap.get("PTBaseURL")) .setRequestHeaders(new RequestHeaders() { @Override public List<Header> get() { List<Header> headers = new ArrayList<Header>(); Header authHeader = new Header("Authorization", authType + " " + UserManager.getInstance().currentUser.token); headers.add(authHeader); } return headers; } })

How to use GraphQL with Retrofit on Android?

拥有回忆 提交于 2020-01-02 02:59:08
问题 I'm new to GraphQL but I have been using Retrofit for a while now and its easy to use and fast. GraphQL is much different than rest apis in terms of how you pass data. There really are not too many tutorials out there on using GraphQL with Android, I was only able to find this video (https://www.youtube.com/watch?v=P0uJHI7GjIc&t=1s) but there is no real code in there. In my current code for retrofit calls I have an endpoint I set like so: final RestAdapter restAdapter = new RestAdapter

How can I debug my retrofit API call?

前提是你 提交于 2020-01-01 23:12:48
问题 I'm using retrofit to get some data from the Flickr api. The method I'm making the call in looks like this: public static List<String> getImageIds(int size) { Call<PhotosList> call = flickrService.getPhotos(apiKey, format, "1"); Log.d("TEMP_TAG", "photo url: " + call.request().url().toString()); photoIds = new ArrayList<String>(); call.enqueue(new Callback<PhotosList>(){ @Override public void onResponse(Call<PhotosList> call, Response<PhotosList> response) { Log.d("TEMP_TAG", "it's getting

How can I debug my retrofit API call?

故事扮演 提交于 2020-01-01 23:11:46
问题 I'm using retrofit to get some data from the Flickr api. The method I'm making the call in looks like this: public static List<String> getImageIds(int size) { Call<PhotosList> call = flickrService.getPhotos(apiKey, format, "1"); Log.d("TEMP_TAG", "photo url: " + call.request().url().toString()); photoIds = new ArrayList<String>(); call.enqueue(new Callback<PhotosList>(){ @Override public void onResponse(Call<PhotosList> call, Response<PhotosList> response) { Log.d("TEMP_TAG", "it's getting

How can I avoid repeating common observable configuration?

随声附和 提交于 2020-01-01 18:19:31
问题 I'm writing an API client in Android using Retrofit and this sort of code gets repeated a lot: myObservableFromRetrofit .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnError(... print stack trace ...) I'm wondering if there is a technique to avoid repeating this stuff. I surrounding calls to retrofit functions with: public Observable<?> commonObservable(Observable<?> observable) { return observable .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers

How to send Array of Objects in retrofit Android?

こ雲淡風輕ζ 提交于 2020-01-01 17:23:49
问题 I have an below array of objects to be passed in the service call. [ { "ParkingSpace": { "sid": "WorldSensing.vhu6lom3sovk6ahpogebfewk5kqadvs4.5385fc250cf2497dfe5679d1" } }, { "ParkingSpace": { "sid": "WorldSensing.vhu6lom3sovk6ahpogebfewk5kqadvs4.5385ff2f0cf2497dfe567c0c" } }, { "ParkingSpace": { "sid": "WorldSensing.vhu6lom3sovk6ahpogebfewk5kqadvs4.5385fd700cf2e65ecf6330c6" } }, { "ParkingSpace": { "sid": "WorldSensing.vhu6lom3sovk6ahpogebfewk5kqadvs4.5385fefe0cf2497dfe567bee" } }, {

Using flatMap in RxJava 2.x

戏子无情 提交于 2020-01-01 11:58:11
问题 I'm working with an API of my own and a i'm hoping to chain a few paginated results using RxJava. I use cursor based pagination. (imagine there are 50 users in this first request): { "data":{ "status":"ok", "total":988, //users total "has_next_page":true, "end_cursor":"AQAxd8QPGHum7LSDz8DnwIh7yHJDM22nEjd", "users":[{"id":"91273813", "username":"codergirl", "full_name":"Code Girl", "picture_url":"https://cdn.com/21603182_7904715668509949952_n.jpg", }, ... ] } } Right now, I'm getting the first