I'm new using this especial classes. My problem is:
I recieve in a variable this JSON message:
String buffer = stringBuilder.toString();
String Buffer is this information. It has a list of empresas (Bussiness) and one parameter is a List of Proyects(that has two variables: money and information).
[
{
"name": "LOL",
"address": "LCS",
"phonenumber": 98987845,
"email": "david@gmail.com",
"creditcard": "7674774",
"proyects": [
{
"money": 30000,
"information": "This is my proyect",
"id": 1
},
{
"money": 0,
"information": "My second proyect",
"id": 2
}
],
"id": 1
},
{
"name": "UPC",
"address": "Castelldefels",
"phonenumber": 93245098,
"email": "aasasaasa@gmail.com",
"creditcard": "asdfg9876",
"proyects": [],
"id": 2
}
]
So then i create 3 java.class: For example the class User is the following:
package com.example.david.dhl;
import java.util.List;
class User {
static String name;
static String password;
static List<Empresa> Empresas;
private static final Usuario ourInstance = new Usuario();
static Usuario getInstance() {
return ourInstance;
}
public String getname() {
return nombre;
}
public String getPassword() {
return password;
}
private User() {
}
}
How can i save all the information in the different singleton classes? When i do this:
String a = User.getInstance().name;
It said that is empty.
Thank you very much.
PD: if any moderator can put the code more visual will be so nice, because i'm new and i don't find anything. Thank you.