android.app.Activity.finish()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(391)

本文整理了Java中android.app.Activity.finish()方法的一些代码示例,展示了Activity.finish()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.finish()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:finish

Activity.finish介绍

暂无

代码示例

代码示例来源:origin: square/picasso

public void launch(Activity activity) {
  activity.startActivity(new Intent(activity, activityClass));
  activity.finish();
 }
}

代码示例来源:origin: stackoverflow.com

@Override
public void navigateUpTo(Activity activity, Intent upIntent) {
  upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  activity.startActivity(upIntent);
  activity.finish();
}

代码示例来源:origin: square/leakcanary

@Override public void finish() {
 // Reset the animation to avoid flickering.
 overridePendingTransition(0, 0);
 super.finish();
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 protected void onPostExecute(Void unused) {
  if (text!=null) {
   Toast.makeText(host, text, Toast.LENGTH_SHORT).show();
  }
  
  host.finish();
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onDismiss(DialogInterface dlg) {
  if (getActivity()!=null) {
   getActivity().finish();
  }
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public boolean onOptionsItemSelected(MenuItem item) {
 if (item.getItemId()==R.id.reset) {
  loader.reset();
  getActivity().finish();
  return(true);
 }
 return(super.onOptionsItemSelected(item));
}

代码示例来源:origin: robolectric/robolectric

@Test
 public void testInjection() {
  activity.finish();
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onCancel(DialogInterface dlg) {
 if (getActivity()!=null) {
  getActivity().finish();
 }
 super.onCancel(dlg);
}

代码示例来源:origin: pockethub/PocketHub

/**
 * Show conflict message about previously registered authenticator from
 * another application
 *
 * @param activity
 */
private static void showConflictMessage(final Activity activity) {
  new MaterialDialog.Builder(activity)
      .title(R.string.authenticator_conflict_title)
      .content(R.string.authenticator_conflict_message)
      .positiveText(android.R.string.ok)
      .cancelListener(dialog -> activity.finish())
      .onPositive((dialog, which) -> activity.finish())
      .show();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldCallFinishOnFinish() {
 Activity activity = new Activity();
 activity.finish();
 assertTrue(activity.isFinishing());
}

代码示例来源:origin: robolectric/robolectric

@Test
public void createActivity_noDisplayFinished_shouldFinishActivity() {
 ActivityController<Activity> controller = Robolectric.buildActivity(Activity.class);
 controller.get().setTheme(android.R.style.Theme_NoDisplay);
 controller.create();
 controller.get().finish();
 controller.start().visible().resume();
 activity = controller.get();
 assertThat(activity.isFinishing()).isTrue();
}

相关文章

Activity类方法