我的Json数据:
{
"customer": [
{
"CustomerRequestId": 30,
"CustomerId": 24,
"CustomerName": "Saravanan",
"Phonenumber": "9095897331",
"PickupLat": "13.0667902",
"PickupLng": "80.2458975",
"DropLat": "13.0824243",
"DropLng": "80.27546889999999",
"FromLoc": "19-22, College Rd, Subba Road Avenue, Nungambakkam, Chennai, Tamil Nadu 600006, India",
"ToLoc": "Station Rd, Kannappar Thidal, Periyamet, Chennai, Tamil Nadu 600003, India"
},
{
"CustomerRequestId": 29,
"CustomerId": 4,
"CustomerName": "driver",
"Phonenumber": "9876543210",
"PickupLat": "13.0667902",
"PickupLng": "80.2458975",
"DropLat": "11.5432364",
"DropLng": "79.47601329999999",
"FromLoc": "19-22, College Rd, Subba Road Avenue, Nungambakkam, Chennai, Tamil Nadu 600006, India",
"ToLoc": "Nanthanar Nagar, Neyveli, Tamil Nadu 607802, India"
},
{
"CustomerRequestId": 31,
"CustomerId": 24,
"CustomerName": "Saravanan",
"Phonenumber": "9095897331",
"PickupLat": "13.0654988",
"PickupLng": "80.2432399",
"DropLat": "12.9234492",
"DropLng": "80.1587694",
"FromLoc": "Gee Gee Emerald Towers, Sterling Rd, Seetha Nagar, Nungambakkam, Chennai, Tamil Nadu 600034, India",
"ToLoc": "231, Velachery Tambaram Main Rd, Durga Colony, Sembakkam, Chennai, Tamil Nadu 600073, India"
},
{
"CustomerRequestId": 28,
"CustomerId": 1,
"CustomerName": "aravind",
"Phonenumber": "1234567890",
"PickupLat": "13.056979199999997",
"PickupLng": "80.2487355",
"DropLat": "11.7465352",
"DropLng": "79.7555841",
"FromLoc": "27/14, Nungambakkam High Rd, Tirumurthy Nagar, Nungambakkam, Chennai, Tamil Nadu 600034, India",
"ToLoc": "79, Lawrence Rd, Market Colony, Thirupapuliyur, Cuddalore, Tamil Nadu 607002, India"
},
{
"CustomerRequestId": 32,
"CustomerId": 21,
"CustomerName": "raja",
"Phonenumber": "2012356489",
"PickupLat": "13.0654969",
"PickupLng": "80.2432014",
"DropLat": "10.7904833",
"DropLng": "78.7046725",
"FromLoc": "Gee Gee Emerald Towers, Sterling Rd, Seetha Nagar, Nungambakkam, Chennai, Tamil Nadu 600034, India",
"ToLoc": "Chennai - Villupuram - Trichy - Kanyakumari Rd, Hanifa Colony, Railway Colony, Tiruchirappalli, Tamil Nadu 620020, India"
},
{
"CustomerRequestId": 33,
"CustomerId": 25,
"CustomerName": "prabu",
"Phonenumber": "9095897331",
"PickupLat": "13.0654359",
"PickupLng": "80.2441922",
"DropLat": "12.923290699999999",
"DropLng": "80.1599004",
"FromLoc": "68/75-79, Subba Road Avenue, Nungambakkam, Chennai, Tamil Nadu 600034, India",
"ToLoc": "231, Velachery Tambaram Main Rd, Durga Colony, Sembakkam, Chennai, Tamil Nadu 600073, India"
}
]
}
需要获取所有Pickup Latitude Longitude并在地图上放置标记。谁能帮我这个?我能够获取所有数据并在活动中查看它。但我无法在地图上添加标记。)
private ArrayList<CustomerRequestList> dataList;
Activity thisActivity;
Context context;
ApiInterface apiInterface = ApiClient.getRetrofit().create(ApiInterface.class);
public CustomerListAdapter(ArrayList<CustomerRequestList> dataList) {
this.dataList = dataList;
}
@Override
public CustomerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
View view = layoutInflater.inflate(R.layout.activity_driver_request_list, parent, false);
return new CustomerViewHolder(view);
}
@Override
public void onBindViewHolder(CustomerViewHolder holder, int position) { holder.txtCusName.setText(dataList.get(position).getCustomerName());
holder.txtCusPhon.setText(dataList.get(position).getPhonenumber());
holder.txtCusFrom.setText(dataList.get(position).getFromLoc());
holder.txtCusTo.setText(dataList.get(position).getToLoc());
String FromLat = dataList.get(position).getPickupLat();
String FromLng = dataList.get(position).getPickupLng();
String DropLat = dataList.get(position).getDropLat();
String DropLng = dataList.get(position).getDropLng();
Utilities.printV("CustomerLoginResponse===>", FromLat);
Utilities.printV("CustomerLoginResponse===>", FromLng);
Utilities.printV("CustomerLoginResponse===>", DropLat);
Utilities.printV("CustomerLoginResponse===>", DropLng);
}
@Override
public int getItemCount() {
return dataList.size();
}
class CustomerViewHolder extends RecyclerView.ViewHolder {
TextView txtCusName, txtCusFrom, txtCusPhon, txtCusTo;
CustomerViewHolder(View itemView) {
super(itemView);
txtCusName = itemView.findViewById(R.id.txt_Customer_Name);
txtCusPhon = itemView.findViewById(R.id.Customer_phonenumber);
txtCusFrom = itemView.findViewById(R.id.Customer_PickLocation);
txtCusTo = itemView.findViewById(R.id.Customer_DropLocation);
}
}
(请帮我在地图上添加多个标记以获取所有json数据)