Questions tagged as 'gson'

1
answer

How to pass a class as a parameter in another class and return a variable that is inside a Thread

I work with Delphi and decided to learn how to make java applications, and I came across a problem. I have this class public class Dados { public void getJson(final String url) { new Thread(new Runnable() { @Over...
asked by 14.08.2017 / 14:44
0
answers

Pagination with GSON (ANDROID)

I need to make a load on the end of the list, I have 20 items, when I get to the end, I need 20 more. Currently my Fragment that loads the ads is as follows below. new AsyncHttpClient().get(Constantes.URL_WS_BASE + "anuncio/list", n...
asked by 16.06.2017 / 05:27
1
answer

Convert JSON to object with GSON

I have a webservice ready, which returns a JSON of an object, great, working: Here is the returned JSON: {"Opa":{"nome":"Teste1234"}} This JSOn is of the following class: public class Opa { public String nome = "Basico"; } GSON simply...
asked by 16.08.2016 / 17:00
0
answers

Gson returning characters with invalid accent

I'm getting information using Gson in a PHP file. When this information is received, words containing accents are not encoded. I already read: Android JSON CharSet UTF-8 problems Converting String to Android JSONObject loses utf -8...
asked by 06.08.2016 / 20:29
1
answer

Error fetching Information from SharedPreferences Android

I have an android application, and in it I save some basic user information in SharedPreferences, however I started to display the following JSON parse error:    java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1...
asked by 14.04.2016 / 19:43
0
answers

@SkipSerialization

I have a problem with serializing my classes. I'm having a circular reference problem, so I'm trying to handle this by adding the @SkipSerialization annotation in the class to prevent it from being serialized. However, this does not seem to be w...
asked by 11.09.2015 / 04:37
1
answer

Convert Gson to ListObject

I'm starting to learn how to use the Gson library in my code and need to create a list of objects from a Json file. Json: [{"id":1,"cat":"teste","icone":"icone"},{"id":2,"cat":"teste2","icone":"icone2"}] of this file two Objects (CategoryIt...
asked by 09.05.2018 / 18:41
1
answer

Serializing and deserializing attributes with names other than Json fields

I'm having the need to serialize and deserialize an attribute that your Json reference has a different name. For example, in the Json I am receiving there is a text field and I would like the value of this attribute to be filled in my att...
asked by 11.05.2017 / 15:24
1
answer

Error in retrofit2 convert-gson: 2.1.0 [closed]

I'm having a very persistent error in Retrofit2 with error in line GsonConverterFactory.create() I've tried a lot of things and I can not do it. Retrofit retrofit = new Retrofit.Builder() .baseUrl(UdacityService.BASE_URL)...
asked by 13.01.2017 / 19:38
1
answer

How to get data received in JSON and store in a class

Good afternoon! I'm having trouble implementing the code to retrieve the data that is coming in JSON and store that data in a class. If someone can help me thank you, this one already. My idea is to get the data from the webservice and...
asked by 23.12.2015 / 14:59