在itemclick上的Google地图上将相机焦点设置在特定标记上

时间:2016-03-27 19:40:57

标签: android json google-maps listview

在此Tutorial的帮助下  我做了onItemClickListner课程

public class OnItemClickListenerListViewItem implements OnItemClickListener {

@Override

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {


    Context context = view.getContext();



    TextView textViewItem = ((TextView) view.findViewById(R.id.textViewItem));



    // get the clicked item name

    String listItemText = textViewItem.getText().toString();



    // get the clicked item ID

    String listItemId = textViewItem.getTag().toString();



    // Toast not showing Item name  

    Toast.makeText(context, "Item: " + listItemText + ", Item ID: " + listItemId, Toast.LENGTH_SHORT).show();

}

  

相机焦点无法正常工作

if (listItemText.equals("ROMYS")) {
        CameraUpdate location = CameraUpdateFactory.newLatLngZoom(
                coordinate, 15);
        googleMap.animateCamera(location);
    }

我试过这个Code,但它不起作用

这是我现在的班级代码myClassCode Pastbin Link

0 个答案:

没有答案