How can I count the number of items in an array in android?
here is the code that dose not work
if (vehicleList.length = 1){
//do something
}
can anyone help?
Use == for comparison..
if (vehicleList.length == 1){
//do something
}
You are trying to assign a value to vehiclelist.length. Use ==
instead which will compare the two values.
if vehicleList is an arrayList
the try like this
if (vehicleList.size() == 1){
//do something
}
精彩评论