Android 如何在onPostExecute中实现列表视图按钮的点击事件?
我有一个列表视图,在我的片段中asynctask的onPostExecute中填充了json数据Android 如何在onPostExecute中实现列表视图按钮的点击事件?,android,Android,我有一个列表视图,在我的片段中asynctask的onPostExecute中填充了json数据 ListAdapter adapter = new SimpleAdapter(getActivity(), branchList, R.layout.list_branch_total_hours, new String[] { TAG_BRANCHID, TAG_BRANCH_NM,TAG_BRANCHCODE,TAG_REGIO
ListAdapter adapter = new SimpleAdapter(getActivity(), branchList,
R.layout.list_branch_total_hours,
new String[] { TAG_BRANCHID, TAG_BRANCH_NM,TAG_BRANCHCODE,TAG_REGIONID,TAG_REGION_NAME,TAG_TOT_HR }, new int[]
{
R.id.hdnBranchId,R.id.btnBranch_nm, R.id.hdnBranchCode,
R.id.hdnRegionId,R.id.hdnRegionNm, R.id.btnTot_Hours}
);
list.setAdapter(adapter);
现在我在列表中有了按钮控件。那么我如何实现按钮的点击事件呢
提前感谢…您可以使用`
ListAdapter adapter = new SimpleAdapter(getActivity(), branchList,
R.layout.list_branch_total_hours,
new String[] { TAG_BRANCHID, TAG_BRANCH_NM,TAG_BRANCHCODE,TAG_REGIONID,TAG_REGION_NAME,TAG_TOT_HR }, new int[]
{
R.id.hdnBranchId,R.id.btnBranch_nm, R.id.hdnBranchCode,
R.id.hdnRegionId,R.id.hdnRegionNm, R.id.btnTot_Hours}
)
{
override method here//
public void getView(...
};
list.setAdapter(adapter);`
重写适配器类的getView()方法并注册单击按钮。我可以在onpostExecute中重写该方法吗?或者我必须创建自定义适配器吗?我不能在asynctask的onpostExecute中重写该方法