Basically I want to convert a JSONObject json into an integer (127181078). When I use this code:
int intOfReceivedID = Integer.parseInt(json);
I get this error message:
java.lang.NumberFormatException: Invalid int: 127181078"
When I use this code:
char[] charArray = json.toCharArray();
String stringCharArray = charArray.toString();
testTextView.setText(stringCharArray);
testTextView gives me: [C@2378e625
However, when I use this code:
preprocessedjson = String.valueOf(json);
testTextView.setText(preprocessedjson);
The TextView gives 127181078, but I get the some error when I parse the text to an integer.
- Can anybody tell me what going on here?
- And could you help me convert my JSONObject into an integer?
This is the php code:
$myfile = fopen($filename, 'r') or die("Unable to open file!");
echo fread($myfile,filesize($filename));
fclose($myfile);
This is the the makeHttpRequest:
JSONObject json = jparser.makeHttpRequest("http://myurl.nl/readspecifictextfile.php","POST",data);