All Questions

Tagged with
Filter by
Sorted by
Tagged with
255votes
14answers
141kviews

java.net.SocketException: socket failed: EPERM (Operation not permitted)

I am working on an Android Studio project with several activities. I am currently trying to read the output from a Java Servlet on localhost but it seems to be crashing due to a socket permission. I'...
user avatar
238votes
9answers
261kviews

Gson - convert from Json to a typed ArrayList<T>

Using the Gson library, how do I convert a JSON string to an ArrayList of a custom class JsonLog? Basically, JsonLog is an interface implemented by different kinds of logs made by my Android app--SMS ...
user avatar
  • 12.9k
204votes
9answers
302kviews

How can I parse a local JSON file from assets folder into a ListView?

I'm currently developing a physics app that is supposed to show a list of formulas and even solve some of them (the only problem is the ListView) This is my main layout <LinearLayout xmlns:...
user avatar
203votes
13answers
397kviews

How to check if a JSON key exists?

So, I get some JSON values from the server but I don't know if there will be a particular field or not. So like: { "regatta_name":"ProbaRegatta", "country":"Congo&...
user avatar
189votes
9answers
236kviews

Error message 'java.net.SocketException: socket failed: EACCES (Permission denied)'

I get the error message java.net.SocketException: socket failed: EACCES (Permission denied) when I try to apply the code below. This is the function I call and gives me this exception. public ...
user avatar
  • 1,899
167votes
3answers
551kviews

How do I parse JSON in Android? [duplicate]

How do I parse a JSON feed in Android?
user avatar
  • 6,207
154votes
8answers
223kviews

JSON Array iteration in Android/Java

I am building an android app that needs to download and synchronise with an online database, I am sending my query from the app to a php page which returns the relevant rows from a database in JSON ...
user avatar
152votes
7answers
168kviews

Convert object to JSON in Android

Is there a simple method to convert any object to JSON in Android?
user avatar
  • 15.2k
146votes
11answers
272kviews

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

What is this error ? How can I fix this? My app is running but can't load data. And this is my Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ This is my ...
user avatar
  • 2,699
138votes
9answers
94kviews

Determine whether JSON is a JSONObject or JSONArray

I am going to receive either a JSON Object or Array from server, but I have no idea which it will be. I need to work with the JSON, but to do so, I need to know if it is an Object or an Array. I am ...
user avatar
  • 2,950
138votes
11answers
161kviews

Sending and Parsing JSON Objects in Android [closed]

I would like to send messages in the form of JSON objects to a server and parse the JSON response from the server. Example of JSON object { "post": { "username": "John Doe", "message": "...
user avatar
133votes
16answers
268kviews

Convert Json Array to normal Java list

Is there a way to convert JSON Array to normal Java Array for android ListView data binding?
user avatar
132votes
11answers
239kviews

Android- create JSON Array and JSON Object

How can I create a JSON with this format in Android: Since the API that I will be passing will parse JsonArray then the object. Or would it be okay if just to pass a json object? Since I will just ...
user avatar
  • 1,671
129votes
8answers
149kviews

convert ArrayList<MyCustomClass> to JSONArray

I have an ArrayList that I use within an ArrayAdapter for a ListView. I need to take the items in the list and convert them to a JSONArray to send to an API. I've searched around, but haven't found ...
user avatar
  • 4,991

15 30 50 per page
1
2 3 4 5
1698