當前位置: 首頁>>代碼示例>>Java>>正文


Java Bundle.clear方法代碼示例

本文整理匯總了Java中android.os.Bundle.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java Bundle.clear方法的具體用法?Java Bundle.clear怎麽用?Java Bundle.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.os.Bundle的用法示例。


在下文中一共展示了Bundle.clear方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSuspicious

import android.os.Bundle; //導入方法依賴的package包/類
/**
 * Scrubs Bundles for private serializable subclasses in the extras. If the Bundle's extras contain a
 * private serializable subclass, the Bundle is cleared. If the Bundle is null, has no extras, or the
 * extras do not contain a private serializable subclass, the Bundle is not mutated.
 *
 * @param bundle {@code Bundle} to scrub. This parameter may be mutated if scrubbing is necessary. This
 *               parameter may be null.
 * @return true if the Bundle was scrubbed, false if the Bundle was not modified.
 */
public static boolean isSuspicious(@Nullable final Bundle bundle) {

    if (bundle != null) {

    /*
     * Note: This is a hack to work around a private serializable classloader attack
     */
        try {
            // if a private serializable exists, this will throw an exception
            bundle.containsKey(null);
        } catch (final Exception e) {
            bundle.clear();
            return true;
        }
    }

    return false;
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:28,代碼來源:UtilsBundle.java

示例2: scrub

import android.os.Bundle; //導入方法依賴的package包/類
public static boolean scrub(final Bundle bundle) {
    if (null == bundle) {
        return false;
    }
    try {
        // if a private serializable exists, this will throw an exception
        bundle.containsKey(null);
    } catch (final Exception e) {
        bundle.clear();
        return true;
    }

    return false;
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:15,代碼來源:BundleScrubber.java

示例3: clearBundle

import android.os.Bundle; //導入方法依賴的package包/類
private void clearBundle(Bundle safeBundle) {
    safeBundle.clear();
    safeBundle = null;
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:5,代碼來源:Bundler.java

示例4: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.clear();
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:5,代碼來源:WelcomeActivity.java


注:本文中的android.os.Bundle.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。