Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?解決辦法很簡單
加上FLAG_ACTIVITY_NEW_TASK flag就可以。
Intent starter = new Intent(context, MainActivity.class);
starter.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//starter.putExtra("from", from);
context.startActivity(starter);
沒有留言:
張貼留言