Long question on Android

Asked 1 years ago, Updated 1 years ago, 75 views

inti = 11818518518518581; I know that this should be corrected to long. So I know that you have to put an L after long i = 11818518518518581L to recognize it as long.

But now longi = arraylist.get(arraylist.size()-1)-1).You can get the id value of i by doing id, but the id value is 11818518518581. I don't think it's recognized as long because there's no "L" in the back. What should I do? <

jsonObject.put("aaa", 11818518518518581L) results in a value, but jsonObject.put("aaa", i) results in a value ㅜ <

java android long-integer json

2022-09-22 20:40

1 Answers

long i = Long.valueOf(arraylist.get(arraylist.size()-1).id);

Or

long i = new Long(arraylist.get(arraylist.size()-1).id);


2022-09-22 20:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.