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


Java Bundle.putBooleanArray方法代碼示例

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


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

示例1: show

import android.os.Bundle; //導入方法依賴的package包/類
private static void show(FragmentManager fm, int requestCode, String title, CharSequence csPositive, CharSequence csNagative, String[] items, boolean hasDefaultSelect, boolean[] selectedIndexes){
	MultiChoiceFragment dialog = new MultiChoiceFragment();
	Bundle args = new Bundle();
	args.putString(ARG_TITLE, title);
	args.putStringArray(ARG_ITEMS, items);
	if (!hasDefaultSelect){
		boolean[] bs = new boolean[args.getStringArray(ARG_ITEMS).length];
		for(int i=0; i<bs.length; i++){
			bs[i] = false;
		}
		args.putBooleanArray(ARG_SELECTED_INDEXES, bs);
	}else{
		args.putBooleanArray(ARG_SELECTED_INDEXES, selectedIndexes);
	}
	args.putInt(ARG_REQUEST_CODE, requestCode);
	args.putCharSequence(ARG_POSITIVE_TEXT, csPositive);
	args.putCharSequence(ARG_NAGATIVE_TEXT, csNagative);
	dialog.setArguments(args);
	dialog.setCancelable(false);
	dialog.show(fm, TAG);
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:22,代碼來源:MultiChoiceFragment.java

示例2: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void onSaveInstanceState(Bundle state) {
    state.putSerializable(STATE_ENDDATE,endDate);
    state.putSerializable(STATE_STARTDATE,startDate);
    ArrayList<String> subtitles = new ArrayList<>();
    for (int i = 0; i < TOTAL_STEPS; i++ ) {
        subtitles.add(verticalStepper.getStepsSubtitles(i));
    }
    state.putStringArrayList(STATE_SUBTITLES, subtitles);
    boolean[] week_state = new boolean[weekdaysSelection.length];

    for (int i = 0; i < week_state.length; i++) {
        LinearLayout day = getDayLayout(i);
        week_state[i] = (boolean) day.getTag();
    }
    state.putBooleanArray(STATE_WEEK,week_state);
    state.putBoolean(STATE_REP_Single, singleSelected);
    super.onSaveInstanceState(state);
}
 
開發者ID:jcolladosp,項目名稱:ePills,代碼行數:20,代碼來源:AddPillSetTime.java

示例3: toBundle

import android.os.Bundle; //導入方法依賴的package包/類
@NonNull
public Bundle toBundle() {
    Bundle bundle = new Bundle(map.size());
    for (Map.Entry<String, Object> entry : map.entrySet()) {
        String key = entry.getKey();
        Object value = entry.getValue();
        if (value == null) {
            bundle.putString(key, null);
        } else if (value instanceof String) {
            bundle.putString(key, (String) value);
        } else if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) value);
        } else if (value instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) value);
        } else if (value instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) value);
        } else if (value instanceof PersistableBundle) {
            bundle.putBundle(key, ((PersistableBundle) value).toBundle());
        }
    }
    return bundle;
}
 
開發者ID:Doist,項目名稱:JobSchedulerCompat,代碼行數:35,代碼來源:PersistableBundle.java

示例4: putJSONValueInBundle

import android.os.Bundle; //導入方法依賴的package包/類
public static boolean putJSONValueInBundle(Bundle bundle, String key, Object value) {
    if (value == null) {
        bundle.remove(key);
    } else if (value instanceof Boolean) {
        bundle.putBoolean(key, (boolean) value);
    } else if (value instanceof boolean[]) {
        bundle.putBooleanArray(key, (boolean[]) value);
    } else if (value instanceof Double) {
        bundle.putDouble(key, (double) value);
    } else if (value instanceof double[]) {
        bundle.putDoubleArray(key, (double[]) value);
    } else if (value instanceof Integer) {
        bundle.putInt(key, (int) value);
    } else if (value instanceof int[]) {
        bundle.putIntArray(key, (int[]) value);
    } else if (value instanceof Long) {
        bundle.putLong(key, (long) value);
    } else if (value instanceof long[]) {
        bundle.putLongArray(key, (long[]) value);
    } else if (value instanceof String) {
        bundle.putString(key, (String) value);
    } else if (value instanceof JSONArray) {
        bundle.putString(key, ((JSONArray) value).toString());
    } else if (value instanceof JSONObject) {
        bundle.putString(key, ((JSONObject) value).toString());
    } else {
        return false;
    }
    return true;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:31,代碼來源:Utility.java

示例5: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
protected void onSaveInstanceState(Bundle saveInstanceState) {
    super.onSaveInstanceState(saveInstanceState);
    Log.d(TAG, "onSaveInstanceState: called");
    saveInstanceState.putInt(KEY_INDEX,mCurrentIndex);
    saveInstanceState.putBoolean(CheatActivity.EXTRA_IS_CHEATER,mIsCheater);
    saveInstanceState.putBooleanArray(EXTRA_CHEATED_ARRAY,mCheated);
}
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:9,代碼來源:QuizActivity.java

示例6: fromArrayToBundle

import android.os.Bundle; //導入方法依賴的package包/類
public static void fromArrayToBundle(Bundle bundle, String key, Object array) {
    if (bundle != null && !TextUtils.isEmpty(key) && array != null) {
        if (array instanceof String[]) {
            bundle.putStringArray(key, (String[]) ((String[]) array));
        } else if (array instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) ((byte[]) array));
        } else if (array instanceof short[]) {
            bundle.putShortArray(key, (short[]) ((short[]) array));
        } else if (array instanceof int[]) {
            bundle.putIntArray(key, (int[]) ((int[]) array));
        } else if (array instanceof long[]) {
            bundle.putLongArray(key, (long[]) ((long[]) array));
        } else if (array instanceof float[]) {
            bundle.putFloatArray(key, (float[]) ((float[]) array));
        } else if (array instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) ((double[]) array));
        } else if (array instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) ((boolean[]) array));
        } else if (array instanceof char[]) {
            bundle.putCharArray(key, (char[]) ((char[]) array));
        } else {
            if (!(array instanceof JSONArray)) {
                throw new IllegalArgumentException("Unknown array type " + array.getClass());
            }

            ArrayList arraylist = new ArrayList();
            JSONArray jsonArray = (JSONArray) array;
            Iterator it = jsonArray.iterator();

            while (it.hasNext()) {
                JSONObject object = (JSONObject) it.next();
                arraylist.add(fromJsonToBundle(object));
            }

            bundle.putParcelableArrayList(key, arraylist);
        }

    }
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:40,代碼來源:ArgumentsUtil.java

示例7: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void onSaveInstanceState(Bundle savedInstanceState)
{
    savedInstanceState.putBooleanArray(getString(R.string.audio_point_state), mAudioPlaybackController.getDoneArray());
    savedInstanceState.putParcelable(IntentNames.SELECTED_GAME_BRIEF, mCurrentGame);
    savedInstanceState.putInt(getString(R.string.last_active_marker), mLastActiveMarker);

    super.onSaveInstanceState(savedInstanceState);
}
 
開發者ID:LenaShervarly,項目名稱:TreasureHunting,代碼行數:10,代碼來源:MapsActivity.java

示例8: putBooleanArray

import android.os.Bundle; //導入方法依賴的package包/類
public void putBooleanArray(Bundle state, String key, boolean[] x) {
    state.putBooleanArray(key + baseKey, x);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:Injector.java

示例9: putBooleanArray

import android.os.Bundle; //導入方法依賴的package包/類
public void putBooleanArray(Bundle state, String key, boolean[] x) {
    state.putBooleanArray(key + mBaseKey, x);
}
 
開發者ID:evernote,項目名稱:android-state,代碼行數:4,代碼來源:InjectionHelper.java

示例10: saveState

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void saveState(@NonNull Bundle outState) {
    super.saveState(outState);
    outState.putBooleanArray(SAVE_UPDATED, mUpdated);
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:6,代碼來源:FavePhotoPagerPresenter.java

示例11: GenerateUploadBundle

import android.os.Bundle; //導入方法依賴的package包/類
protected Bundle GenerateUploadBundle(String folderName, HashMap<String, Long> files, String serviceClassName){
    Bundle data = new Bundle();
    data.putString(UPLOAD_FOLDER, folderName);
    if (files != null) {
        UploadLogDBHelper dbHelper = new UploadLogDBHelper(getApplicationContext());
         Iterator<String> fileIT = files.keySet().iterator();
         int uploadNum = files.size();
         CharSequence[] fileNameArr = new CharSequence[uploadNum];
         boolean[] uploadTypeArr = new boolean[uploadNum];
         boolean[] isResendArr = new boolean[uploadNum];
         long[] sizeArr = new long[uploadNum];
         String fileName = "";
         long fileSize = 0L;
         int idx = 0;
         //boolean isForceUpload = false;
         FileInfo fileInfo = null;
         while(fileIT.hasNext()) {
             fileName = fileIT.next();
             fileSize = files.get(fileName);
             fileNameArr[idx] = fileName;
             sizeArr[idx] = fileSize;
             try{
                synchronized(mDBLock) {
                   fileInfo = dbHelper.getFileInfo(fileName);
                }
               Log.i(TAG, "GenerateUploadBundle: getFileInfo(" + fileName + ")= isForceUpload: " + fileInfo.isForceUpload + " isResend: " + fileInfo.isResend);
             } catch(Exception ex) {
                 Log.i(TAG, "GenerateUploadBundle: Exception Happen when isForceUploadFile(" + fileName + ") Msg: " + ex.toString());
                 fileInfo = new FileInfo();
             }
             uploadTypeArr[idx] = fileInfo.isForceUpload;
             isResendArr[idx] = fileInfo.isResend;
             idx ++;
         }
        if(dbHelper != null){
           dbHelper.close();
        }
        data.putCharSequenceArray(UPLOAD_FILE_NAMES, fileNameArr);
        data.putLongArray(UPLOAD_SIZES, sizeArr);
        data.putString(UPLOAD_AGENT_PACKAGE, this.getApplicationContext().getPackageName());
        data.putString(UPLOAD_AGENT, serviceClassName);
        data.putBooleanArray(UPLOAD_IS_FORCE_UPLOAD_TYPE, uploadTypeArr);
        data.putBooleanArray(UPLOAD_IS_RESEND_TYPE, isResendArr);
    }

    return data;
}
 
開發者ID:quanzhuo,項目名稱:prada,代碼行數:48,代碼來源:UploadAgent.java

示例12: write

import android.os.Bundle; //導入方法依賴的package包/類
@Override
public void write(Bundle bundle, Object to, StateField field) throws IllegalAccessException {
    Field propertyField = field.getField();
    propertyField.setAccessible(true);
    bundle.putBooleanArray(field.getBundleKey(), (boolean[]) propertyField.get(to));
}
 
開發者ID:leobert-lan,項目名稱:MagicBox,代碼行數:7,代碼來源:BooleanArrayWriter.java

示例13: put

import android.os.Bundle; //導入方法依賴的package包/類
public static void put(Bundle bundle, String key, Object value) {
        if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Float) {
            bundle.putFloat(key, (Float) value);
        } else if (value instanceof Character) {
            bundle.putChar(key, (Character) value);
        } else if (value instanceof CharSequence) {
            bundle.putCharSequence(key, (CharSequence) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Short) {
            bundle.putShort(key, (Short) value);
        } else if (value instanceof Byte) {
            bundle.putByte(key, (Byte) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof Bundle) {
            bundle.putBundle(key, (Bundle) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else if (value instanceof float[]) {
            bundle.putFloatArray(key, (float[]) value);
        } else if (value instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) value);
        } else if (value instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) value);
        } else if (value instanceof Parcelable[]) {
            bundle.putParcelableArray(key, (Parcelable[]) value);
        } else if (value instanceof short[]) {
            bundle.putShortArray(key, (short[]) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else {
//            bundle.putString(key, String.valueOf(value));
        }
    }
 
開發者ID:AlbieLiang,項目名稱:IPCInvoker,代碼行數:46,代碼來源:ParameterHelper.java

示例14: onSaveInstanceState

import android.os.Bundle; //導入方法依賴的package包/類
@Override protected void onSaveInstanceState(final Bundle outState) {
  outState.putBooleanArray(SAVE_RATIONALE, shouldShowRequestPermissionRationale);
  super.onSaveInstanceState(outState);
}
 
開發者ID:vanniktech,項目名稱:RxPermission,代碼行數:5,代碼來源:ShadowActivity.java

示例15: assembleBundle

import android.os.Bundle; //導入方法依賴的package包/類
public Bundle assembleBundle() {
    User user = new User();
    user.setAge(90);
    user.setGender(1);
    user.setName("kitty");

    Address address = new Address();
    address.setCity("HangZhou");
    address.setProvince("ZheJiang");

    Bundle extras = new Bundle();
    extras.putString("extra", "from extras");


    ArrayList<String> stringList = new ArrayList<>();
    stringList.add("Java");
    stringList.add("C#");
    stringList.add("Kotlin");

    ArrayList<String> stringArrayList = new ArrayList<>();
    stringArrayList.add("American");
    stringArrayList.add("China");
    stringArrayList.add("England");

    ArrayList<Integer> intArrayList = new ArrayList<>();
    intArrayList.add(100);
    intArrayList.add(101);
    intArrayList.add(102);

    ArrayList<Integer> intList = new ArrayList<>();
    intList.add(10011);
    intList.add(10111);
    intList.add(10211);

    ArrayList<Address> addressList = new ArrayList<>();
    addressList.add(new Address("JiangXi", "ShangRao", null));
    addressList.add(new Address("ZheJiang", "NingBo", null));

    Address[] addressArray = new Address[]{
            new Address("Beijing", "Beijing", null),
            new Address("Shanghai", "Shanghai", null),
            new Address("Guangzhou", "Guangzhou", null)
    };
    Bundle bundle = new Bundle();
    bundle.putSerializable("user", user);
    bundle.putParcelable("address", address);
    bundle.putParcelableArrayList("addressList", addressList);
    bundle.putParcelableArray("addressArray", addressArray);
    bundle.putString("param", "chiclaim");
    bundle.putStringArray("stringArray", new String[]{"a", "b", "c"});
    bundle.putStringArrayList("stringArrayList", stringList);
    bundle.putStringArrayList("stringList", stringArrayList);
    bundle.putByte("byte", (byte) 2);
    bundle.putByteArray("byteArray", new byte[]{1, 2, 3, 4, 5});
    bundle.putInt("age", 33);
    bundle.putIntArray("intArray", new int[]{10, 11, 12, 13});
    bundle.putIntegerArrayList("intList", intList);
    bundle.putIntegerArrayList("intArrayList", intArrayList);
    bundle.putChar("chara", 'c');
    bundle.putCharArray("charArray", "chiclaim".toCharArray());
    bundle.putShort("short", (short) 1000000);
    bundle.putShortArray("shortArray", new short[]{(short) 10.9, (short) 11.9});
    bundle.putDouble("double", 1200000);
    bundle.putDoubleArray("doubleArray", new double[]{1232, 9999, 8789, 3.1415926});
    bundle.putLong("long", 999999999);
    bundle.putLongArray("longArray", new long[]{1000, 2000, 3000});
    bundle.putFloat("float", 333);
    bundle.putFloatArray("floatArray", new float[]{12.9f, 234.9f});
    bundle.putBoolean("boolean", true);
    bundle.putBooleanArray("booleanArray", new boolean[]{true, false, true});

    return bundle;
}
 
開發者ID:chiclaim,項目名稱:MRouter,代碼行數:74,代碼來源:MainActivity.java


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