All Questions
1,488
questions
0
votes
1
answer
41
views
Kotlin data structure for efficient lookup of nested data
I am currently working on an application that needs to create a mapping between document pdfs and corresponding JSON data files. The files are coming from a third party so I have no control over their ...
-2
votes
0
answers
9
views
Unresolved reference: card_details
class CustomAdapter(
var context: Context,
var id: List ,
var tagId: List ,
var tagName: List,
var logTime: List,
var value: List
) :
RecyclerView.Adapter<CustomAdapter.MyViewHolder>() {
...
0
votes
1
answer
58
views
Unresolved reference: json
When I build a kotlin project with cradle, I cannot use import org.json.JSONObject, and the json package is not in my library. How can I import it?
import org.json.JSONObject
I use kotlin with gradle....
-1
votes
0
answers
45
views
Extract Body from a http response with error code in Kotlin
I am building an app and after placing a call to the backend, I received an error response. I need to extract the body of the http response but I cannot find a good way to do it. The response has an ...
-1
votes
0
answers
25
views
Expected BEGIN_OBJECT but was BEGIN_ARRAY KOTLIN code
Main.kt:
package org.example
import InfoJogo
import com.google.gson.Gson
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse....
0
votes
0
answers
52
views
Sending identical HTTP POST request succeeds from reqbin.com but fails from kotlin mobile app
I am trying to build a simple ping function to a mobile app. I want to send a ping from the app to an azure web app which should receive the ping and save it to an SQL database. I am developing the ...
0
votes
1
answer
79
views
Kotlin default value for non-null field in data class, then dont pass that attribute in json?
I have a data class :
import com.fasterxml.jackson.annotation.JsonInclude
import io.micronaut.serde.annotation.Serdeable
@Serdeable.Deserializable
@JsonInclude(JsonInclude.Include.NON_NULL)
data class ...
0
votes
0
answers
43
views
JSON Syntax Exception when parsing String containing JSON Array using TypeToken via GSON
Am having trouble parsing String containing a JSON array as a List using TypeToken via GSON in my Kotlin program.
dependencies section inside gradle.build.kts:
dependencies {
implementation("...
-1
votes
2
answers
80
views
Remote JSON parsing (Kotlin) [duplicate]
Sorry for newbie question: I'm new in Android/Kotlin.
There is the RecyclerView in which a remote JSON is being parsed.
Here is an actual code of the Activity with this RecyclerView:
import android.os....
0
votes
0
answers
31
views
Error :- InvocationTargetException , FileNotFoundException: contents.json, Fragment, Kotlin
I got These Errors
FATAL EXCEPTION: main
Process: com.example.mykotlinapp, PID: 19988
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$...
0
votes
1
answer
25
views
Error :- lateinit property itemsList (ArrayList) has not been initialized, HomeFragment, Kotlin
I am trying to create a story Book app with Kotlin but I am beginner and learning programing. and I try to create this app with local Json file (loadJsonFromAssets) with glide, in home fragment, but I ...
0
votes
0
answers
42
views
Stack Overflow when using Jackson to convert JsonNode to an instance of a specific class
I'm writing a incoming packet deserializer. All incoming packets is encoded in JSON, and its type depends on field "post_type".
If it's "meta_event", there must be a field called &...
0
votes
0
answers
31
views
fallback nested json errors to default value
I am using kotlinx-serialization.
Let soppose I have this class
@Serializable
class Settings(
val uiScale:Float=1f,
val theme:String="dark",
)
I have serialized this class to a file ...
1
vote
1
answer
48
views
Android: where to store json file to be accessible to both app and user?
I'd like to use a small local JSON config file with a few fields, so my app can read it and know what to do. This file will not be shipped as part of my app. The idea is that the user creates the file ...
1
vote
1
answer
22
views
POSTing JSON objects to server does not work on specific networks, and times out instead
CODE:
private suspend fun sendJsonFile(file: File) {
val url = URL(EC2_URL)
val urlConnection = url.openConnection() as HttpURLConnection
try {
sendJsonFileLog =...