0

How can I retrieve data from MySQL database and store it in an ArrayList? I have already used php scripts to connect to database and get all the data that I want. The data is sent to the webserver in Json format.
Let's say:
1) I have a table in my database based called users.
2) I have a class in Android Studio also called users that provides all the necessary fields for users. (such as id, name, surname, etc.)
3) I want to create an ArrayList (usersList< users>) that contains all the users from the database. How can I do that?

4
  • You can retrieve MySQL data to Android array list via a web service by adding the proxy to android references. Commented Dec 28, 2017 at 14:05
  • Quite long way ahead Commented Dec 28, 2017 at 14:09
  • So you have a JSON file with the data? Commented Dec 28, 2017 at 14:35
  • I actualy have a php file that gets data from the database and sends it at webserver in JSON format Commented Dec 28, 2017 at 15:00

1 Answer 1

1

Use json parsing to convert data from json to array list.

According to your requirement list will contain the different user object after parsing.

json parsing sample code

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.