My JSON Array
is of this format and I am trying to toast
the user_review_ids
values - 63,59,62
. I keep getting what I believe is a reference
to the values, rather than the values themselves - I get in toast
, '[Ljava.lang.String.;@41c19f...
stuff like that.
From what I read I thought methods like copyOf
or clone()
might do the trick but no joy.
My JSON Array
is in this format, on my server:
[{"cat_name":"name1","user_review_ids":[63,59,62],
"private_review_ids":[],"public_review_ids":["9999"],"user_personal_count":3,
"private_count":0,"public_count":1}]
When I try to toast
any of the values for user_personal_count
, private_count
, public_count
, I have no problems, just the array.
Here is my code in the Category
object:
String cat_name;
String [] user_review_ids;
String user_personal_count;
String private_count;
String public_count;
public Category() {
}
public String getName() {
//return the value of the JSON key named cat_name in php file
return cat_name;
}
public String[] getUserReviewIds() {
//return the value of the JSON key named user_personal_count in php file
// return user_personal_count;
return user_review_ids;
}
public String getUserPersonalCount() {
//return the value of the JSON key named user_personal_count in php file
return user_personal_count;
}
public String getPrivateCount() {
//return the value of the JSON key named private_count in php file
return private_count;
}
public String getPublicCount() {
return public_count;
}
}
And the function that toasts the value, which is in another class:
@Override
public void onContactSelected(Category category) {
Toast.makeText(getApplicationContext(), "Selected: " + category.getUserReviewIds(), Toast.LENGTH_LONG).show();
}