Start Intent in Adapter

前端 未结 8 1687
清酒与你
清酒与你 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:12

    Pass Context via Constructor and then just use this line of code:

    Intent intent=new Intent(context.getApplicationContext(), YourActivity.class);
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
      context.getApplicationContext().startActivity(intent);
    

    Thanks :)

提交回复
热议问题