示例#1
0
  public static void startActivity(Intent intent) {

    BaseActivity activity = BaseActivity.getForegroundActivity();
    if (activity != null) {
      activity.startActivity(intent);
    } else {
      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      getContext().startActivity(intent);
    }
  }
示例#2
0
 private static void showToast(String str) {
   BaseActivity frontActivity = BaseActivity.getForegroundActivity();
   if (frontActivity != null) {
     Toast.makeText(frontActivity, str, Toast.LENGTH_LONG).show();
   }
 }