当前位置: 首页>>代码示例>>Java>>正文


Java Activity.finish方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:zhou-you,项目名称:RxEasyHttp,代码行数:11,代码来源:AppTools.java

示例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;
            }
        }
    }
}
 
开发者ID:senierr,项目名称:ModuleFrame,代码行数:16,代码来源:ActivityUtil.java

示例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();
        }
    }
}
 
开发者ID:Jusenr,项目名称:AppFirCloud,代码行数:16,代码来源:ActivityManager.java

示例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();
    }
}
 
开发者ID:gengqifu,项目名称:361Camera,代码行数:11,代码来源:Camera2Fragment.java

示例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();
    }
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:10,代码来源:FunctionHelper.java

示例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,结束内存
    }
}
 
开发者ID:paradoxie,项目名称:DizzyPassword,代码行数:11,代码来源:AppManager.java

示例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();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:12,代码来源:CommonUtils.java

示例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));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:QQShareInstance.java

示例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();
        }
    }
}
 
开发者ID:chiclaim,项目名称:MRouter,代码行数:15,代码来源:RouterActivityManager.java

示例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();
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:ActivityManager.java

示例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();
    }
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:16,代码来源:SealAppContext.java

示例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);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:18,代码来源:FDroidApp.java

示例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);
}
 
开发者ID:xiarunhao123,项目名称:PureNews,代码行数:15,代码来源:BaseApplication.java

示例14: finishAll

import android.app.Activity; //导入方法依赖的package包/类
public static void finishAll(){
    for (Activity activity:activities) {
        if (!activity.isFinishing()) {
            activity.finish();
        }
    }
    activities.clear();
}
 
开发者ID:Qinlong275,项目名称:AndroidBookTest,代码行数:9,代码来源:ActivityCollector.java

示例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解散群直接退出多人会话
            }
        }
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:13,代码来源:DefalutTeamSessionCustomization.java


注:本文中的android.app.Activity.finish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。