GridView x BaseAdapter并在onItemClick中重新加载

时间:2011-02-01 16:24:51

标签: java android

遵循example of GridView如何在onItemClick事件中运行新的图像查询? 我可以在那次活动中投射我的BaseAdapter吗?

1 个答案:

答案 0 :(得分:0)

在这里提出一个问题给了我灵感,呵呵......

        gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            try
            {
                ((myCustomAdapter)parent.getAdapter()).myMethod("new_param");
                ((GridView)v.getParent()).invalidateViews();

            } 
            catch (Exception e) {
                System.out.println("onItemClick Excpetion = " + e);
            }
        }
    });