Start Intent in Adapter

前端 未结 8 1688
清酒与你
清酒与你 2021-02-02 13:32

I want to start a new activity from this base adapter.

public class EfficientAdapter extends BaseAdapter {

    private Activity activity;
    private ArrayList         


        
8条回答
  •  南方客
    南方客 (楼主)
    2021-02-02 14:05

    set clickListener on listview in mainactivity from there start the intent

        lv.setAdapter(adapter);
    lv.setOnItemClickListener(new OnItemClickListener()
    {
    @Override public void onItemClick(AdapterView arg0, View arg1,int position, long arg3)
    { 
        Intent intent = new Intent(getActivity,Test.class);
    startActivity(intent);
    }
    });
    

提交回复
热议问题