Start a new Activity from non Activity class

前端 未结 3 1114
长情又很酷
长情又很酷 2020-12-01 16:15

I want to start a new activity in non-Activity class that implements a DialogListener following is my code:

public class FacebookLoginDialog imp         


        
3条回答
  •  不思量自难忘°
    2020-12-01 16:37

    Pass context as constructor parameter and then try this

    Intent i = new Intent(this, SearchActivity.class);
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);
    

提交回复
热议问题