Привет Подскажите, пожалуйста, почему вылетает следующая ошибка:
04-21 11:35:30.535 14997-15055/com.example.serg.yandextestproject E/AndroidRuntime: FATAL EXCEPTION: Thread-13020
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 890
at com.google.gson.Gson.fromJson(Gson.java:818)
at com.example.serg.yandextestproject.activities.PreviewActivity.run(PreviewActivity.java:102)
at java.lang.Thread.run(Thread.java:856)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 890
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505)
at com.google.gson.stream.JsonReader.skipQuotedValue(JsonReader.java:1100)
at com.google.gson.stream.JsonReader.skipValue(JsonReader.java:1229)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:170)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:81)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:60)
at com.google.gson.Gson.fromJson(Gson.java:803)
at com.example.serg.yandextestproject.activities.PreviewActivity.run(PreviewActivity.java:102)
at java.lang.Thread.run(Thread.java:856)
Советы stackoverflow чет не помогли. Использую код :
Gson gson = new Gson();
ArrayList<ArtistData> artists = gson.fromJson(new String(data, "UTF-8"), new TypeToken<List<ArtistData>>() {
}.getType());
где data - это заполненный byte[].Ну и собственно это все делается в потоке