當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。