Cannot resolve method startActivity()

后端 未结 4 709
天命终不由人
天命终不由人 2021-02-07 09:08

I\'m new to the android development and having a bit of a problem changing activities. I am trying to change activities from within a method but I am getting the error can

4条回答
  •  清歌不尽
    2021-02-07 09:59

    First you should get your Context:

    private Context context;
    
    public CustomAdapter(Context context) {
        this.context = context;
    }
    

    And then:

    context.startActivity(openThree);
    

提交回复
热议问题