listview onitemclicklistener无法使用inflater

时间:2015-01-08 06:07:39

标签: android listviewitem

private class CustomInfoWindowAdapter implements InfoWindowAdapter{

    enter code here
        private View view;

        public CustomInfoWindowAdapter() {
            //view = getLayoutInflater().inflate(R.layout.custom_info_window, null);
        }

        @SuppressLint("InflateParams")
        @Override
        public View getInfoContents(Marker marker) {

            view = getLayoutInflater().inflate(R.layout.custom_info_window, null);
            Log.d("call", filteredDataList.toString());
            try {
                if(filteredDataList.size() != 0){
                    listitemview = (ListView) view.findViewById(R.id.ListItems);
                    InfoItemAdapter adp = new InfoItemAdapter(BuyScreenCustomListview.this,
                            position, filteredDataList);
                    listitemview.setAdapter(adp);

listitemview.setOnItemClickListener(new OnItemClickListener() {

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

                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }


            LatLng l = marker.getPosition();


            Log.d("value","" + l.latitude);
            return view;
        }

        @Override
        public View getInfoWindow(Marker marker) {
            return null;
        }

    }

1 个答案:

答案 0 :(得分:0)

替换你的

 listitemview.setOnItemClickListener(new OnItemClickListener() {

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

   listitemview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            // TODO Auto-generated method stub

        }
    });