本文整理汇总了Java中android.app.Activity.finish方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.finish方法的具体用法?Java Activity.finish怎么用?Java Activity.finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.finish方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startForwardActivity
import android.app.Activity; //导入方法依赖的package包/类
public static void startForwardActivity(Activity context, Class<?> forwardActivity, Bundle bundle, Boolean isFinish) {
Intent intent = new Intent(context, forwardActivity);
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (bundle != null)
intent.putExtras(bundle);
context.startActivity(intent);
if (isFinish) {
context.finish();
}
}
示例2: finish
import android.app.Activity; //导入方法依赖的package包/类
/**
* 结束某类活动
*
* @param cls 活动类别
*/
public void finish(Class<?> cls) {
if (cls != null) {
for (Activity activity : activityList) {
if (activity.getClass().equals(cls)) {
activity.finish();
return;
}
}
}
}
示例3: finishActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 关闭指定activity
*
* @param activityClass
*/
public void finishActivity(Class<?> activityClass) {
if (mActivityList == null) {
return;
}
for (Activity activity : mActivityList) {
if (activity.getClass().equals(activityClass)) {
activity.finish();
}
}
}
示例4: showMissingPermissionError
import android.app.Activity; //导入方法依赖的package包/类
/**
* Shows that this app really needs the permission and finishes the app.
*/
private void showMissingPermissionError() {
Activity activity = getActivity();
if (activity != null) {
Toast.makeText(activity, R.string.request_permission, Toast.LENGTH_SHORT).show();
activity.finish();
}
}
示例5: startNewActivity
import android.app.Activity; //导入方法依赖的package包/类
public static void startNewActivity(Activity activity, Class<?> cls, boolean isFinish, Bundle bundle) {
Intent intent = new Intent(activity, cls);
intent.putExtra(Constant.BUNDLE, bundle);
activity.startActivity(intent);
if (isFinish) {
activity.finish();
}
}
示例6: finishActivity
import android.app.Activity; //导入方法依赖的package包/类
/**
* 结束指定的Activity
*/
public void finishActivity(Activity activity) {
if (activity != null) {
//activityStack.remove(activity);// 先从堆栈里移除
activity.finish();// 再结束当前的Activity
activity = null;// 之后把引用变为null,结束内存
}
}
示例7: finishAffinity
import android.app.Activity; //导入方法依赖的package包/类
@TargetApi(16)
public static void finishAffinity(Activity activity, int resultCode) {
if (activity != null) {
if (VERSION.SDK_INT >= 16) {
activity.finishAffinity();
return;
}
activity.setResult(resultCode);
activity.finish();
}
}
示例8: shareText
import android.app.Activity; //导入方法依赖的package包/类
@Override
public void shareText(int platform, String text, Activity activity, ShareListener listener) {
if (platform == SharePlatform.QZONE) {
shareToQZoneForText(text, activity, listener);
} else {
activity.finish();
listener.shareFailure(new Exception(INFO.QQ_NOT_SUPPORT_SHARE_TXT));
}
}
示例9: finishAllActivityExcept
import android.app.Activity; //导入方法依赖的package包/类
public void finishAllActivityExcept(String routerPath) {
Class clazz = RouteManager.getInstance().getRoute(routerPath);
if (clazz == null) {
return;
}
Iterator<Activity> it = stack.iterator();
while (it.hasNext()) {
Activity activity = it.next();
if (null != activity && !activity.getClass().equals(clazz)) {
it.remove();
activity.finish();
}
}
}
示例10: remove
import android.app.Activity; //导入方法依赖的package包/类
public synchronized void remove(String activity) {
for (Activity a : createdActivities) {
if (!a.isFinishing() && a.getClass().getSimpleName().equals(activity)) {
a.finish();
}
}
}
示例11: popAllActivity
import android.app.Activity; //导入方法依赖的package包/类
public void popAllActivity() {
try {
if (MainActivity.mViewPager != null) {
MainActivity.mViewPager.setCurrentItem(0);
}
for (Activity activity : mActivities) {
if (activity != null) {
activity.finish();
}
}
mActivities.clear();
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: forceChangeTheme
import android.app.Activity; //导入方法依赖的package包/类
/**
* Force reload the {@link Activity to make theme changes take effect.}
* Same as {@link Languages#forceChangeLanguage(Activity)}
*
* @param activity the {@code Activity} to force reload
*/
public static void forceChangeTheme(Activity activity) {
Intent intent = activity.getIntent();
if (intent == null) { // when launched as LAUNCHER
return;
}
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
activity.finish();
activity.overridePendingTransition(0, 0);
activity.startActivity(intent);
activity.overridePendingTransition(0, 0);
}
示例13: exitApp
import android.app.Activity; //导入方法依赖的package包/类
/**
* 退出应用,kill进程
*/
public void exitApp() {
if (null != allActivities) {
synchronized (allActivities) {
for (Activity act : allActivities) {
act.finish();
}
}
}
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
示例14: finishAll
import android.app.Activity; //导入方法依赖的package包/类
public static void finishAll(){
for (Activity activity:activities) {
if (!activity.isFinishing()) {
activity.finish();
}
}
activities.clear();
}
示例15: onActivityResult
import android.app.Activity; //导入方法依赖的package包/类
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
if (requestCode == TeamRequestCode.REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
String reason = data.getStringExtra(TeamExtras.RESULT_EXTRA_REASON);
boolean finish = reason != null && (reason.equals(TeamExtras
.RESULT_EXTRA_REASON_DISMISS) || reason.equals(TeamExtras.RESULT_EXTRA_REASON_QUIT));
if (finish) {
activity.finish(); // 退出or解散群直接退出多人会话
}
}
}
}