Java Code Examples for android.os.Bundle.getIntegerArrayList()

The following are Jave code examples for showing how to use getIntegerArrayList() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Nird2   File: BaseContactSelectorFragment.java   View Source Code Vote up 7 votes
@Override
@CallSuper
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	View contentView = inflater.inflate(R.layout.list, container, false);

	list = (BriarRecyclerView) contentView.findViewById(R.id.list);
	list.setLayoutManager(new LinearLayoutManager(getActivity()));
	list.setEmptyText(getString(R.string.no_contacts_selector));
	adapter = getAdapter(getContext(), this);
	list.setAdapter(adapter);

	// restore selected contacts if available
	if (savedInstanceState != null) {
		ArrayList<Integer> intContacts =
				savedInstanceState.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			selectedContacts = getContactsFromIntegers(intContacts);
		}
	}
	return contentView;
}
 
Example 2
Project: Nird2   File: ContactSelectorActivity.java   View Source Code Vote up 7 votes
@Override
public void onCreate(@Nullable Bundle bundle) {
	super.onCreate(bundle);

	setContentView(getLayout());

	if (bundle != null) {
		// restore group ID if it was saved
		byte[] groupBytes = bundle.getByteArray(GROUP_ID);
		if (groupBytes != null) groupId = new GroupId(groupBytes);
		// restore selected contacts if a selection was saved
		ArrayList<Integer> intContacts =
				bundle.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			contacts = getContactsFromIntegers(intContacts);
		}
	}
}
 
Example 3
Project: Nird2   File: BaseContactSelectorFragment.java   View Source Code Vote up 7 votes
@Override
@CallSuper
public View onCreateView(LayoutInflater inflater,
		@Nullable ViewGroup container,
		@Nullable Bundle savedInstanceState) {

	View contentView = inflater.inflate(R.layout.list, container, false);

	list = (BriarRecyclerView) contentView.findViewById(R.id.list);
	list.setLayoutManager(new LinearLayoutManager(getActivity()));
	list.setEmptyText(getString(R.string.no_contacts_selector));
	adapter = getAdapter(getContext(), this);
	list.setAdapter(adapter);

	// restore selected contacts if available
	if (savedInstanceState != null) {
		ArrayList<Integer> intContacts =
				savedInstanceState.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			selectedContacts = getContactsFromIntegers(intContacts);
		}
	}
	return contentView;
}
 
Example 4
Project: Nird2   File: ContactSelectorActivity.java   View Source Code Vote up 7 votes
@Override
public void onCreate(@Nullable Bundle bundle) {
	super.onCreate(bundle);

	setContentView(getLayout());

	if (bundle != null) {
		// restore group ID if it was saved
		byte[] groupBytes = bundle.getByteArray(GROUP_ID);
		if (groupBytes != null) groupId = new GroupId(groupBytes);
		// restore selected contacts if a selection was saved
		ArrayList<Integer> intContacts =
				bundle.getIntegerArrayList(CONTACTS);
		if (intContacts != null) {
			contacts = getContactsFromIntegers(intContacts);
		}
	}
}
 
Example 5
Project: eBread   File: ShowDocumentFragment.java   View Source Code Vote up 7 votes
/**
 * Receive the audio and sync data from the TTS engine
 * The it checks if the data received is valid or there as an error on the request
 * @param result A Bundle containing a byte[] and a ArrayList<Integer>
 */
@Override
public void returnTTSData(Bundle result) {
    //Check if the activity is still alive when the async call come back
    if(getActivity() != null) {
        boolValues.put("waiting",false);
        if (result.getByteArray("audio") == null || result.getIntegerArrayList("tokens") == null) {
            if (audioPlayer != null && (audioPlayer.isPlaying() == true || boolValues.get("isPaused"))) {
                boolValues.put("netErrorBoolean", true);
                //netErrorBoolean = true;
            } else {
                netError();
            }
            return;
        }
        bufferAudio.add(result.getByteArray("audio"));
        bufferSyncData.add(result.getIntegerArrayList("tokens"));
        startPlayer();
    }
}
 
Example 6
Project: BlackList   File: AddOrEditContactFragment.java   View Source Code Vote up 7 votes
private void addRowsToNumbersList(Bundle data) {
    if (data == null) {
        return;
    }
    // get numbers and types from parameters
    ArrayList<String> numbers = data.getStringArrayList(CONTACT_NUMBERS);
    ArrayList<Integer> types = data.getIntegerArrayList(CONTACT_NUMBER_TYPES);
    if (numbers != null && types != null && numbers.size() == types.size()) {
        // get the set of unique pairs of numbers/types form the current view
        Set<Pair<String, Integer>> numbers2TypeSet = getNumber2TypePairs();
        for (int i = 0; i < numbers.size(); i++) {
            String number = numbers.get(i);
            int type = types.get(i);
            // add to View only rows with unique pair of number/type
            if (numbers2TypeSet.add(new Pair<>(number, type))) {
                addRowToNumbersList(number, type);
            }
        }
    }
}
 
Example 7
Project: SimpleDialogFragments   File: SimpleListDialog.java   View Source Code Vote up 7 votes
@Override
protected Bundle onResult(int which) {
    Bundle result = super.onResult(which);
    if (result != null) {

        ArrayList<Integer> positions = result.getIntegerArrayList(SELECTED_POSITIONS);
        if (positions != null) {
            ArrayList<String> labels = new ArrayList<>(positions.size());
            for (Integer pos : positions) {
                labels.add(mData.get(pos).getString());
            }
            result.putStringArrayList(SELECTED_LABELS, labels);
        }

        if (result.containsKey(SELECTED_SINGLE_POSITION)) {
            result.putString(SELECTED_SINGLE_LABEL, mData.get(
                    result.getInt(SELECTED_SINGLE_POSITION)).getString());
        }

    }
    return result;
}
 
Example 8
Project: SimpleRssReader   File: SavedEntriesFragment.java   View Source Code Vote up 6 votes
@Override
public Loader onCreateLoader(final int id, final Bundle args) {
    switch (id) {
        case SavedEntriesQueryLoader.ID:
            return new SavedEntriesQueryLoader(getActivity(), getSortOrder());
        case SavedEntriesDeleteLoader.ID:
            return new SavedEntriesDeleteLoader(getActivity(),
                    args.getIntegerArrayList(KEY_POSITIONS));
        default:
            return null;
    }
}
 
Example 9
Project: android-chessclock   File: MultiSelectionUtil.java   View Source Code Vote up 6 votes
private void readInstanceState(Bundle savedInstanceState) {
    if (savedInstanceState != null) {

        ArrayList<Integer> checkedPos = savedInstanceState.getIntegerArrayList(getStateKey());
        if (checkedPos != null && checkedPos.size() > 0) {
            mItemsToCheck = new ArrayList<Integer>();
            for (int pos : checkedPos) {
                mItemsToCheck.add(pos);
            }
        }
    }
}
 
Example 10
Project: auto-value-bundle   File: AutoValue_TestClassBundled.java   View Source Code Vote up 6 votes
public static TestClassBundled unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundled(
            bundle,
            bundle.getByte("some_byte"),
            bundle.getBoolean("some_boolean"),
            bundle.getShort("some_short"),
            bundle.getInt("some_int"),
            bundle.getLong("some_long"),
            bundle.getChar("some_char"),
            bundle.getFloat("some_float"),
            bundle.getDouble("some_double"),
            bundle.getString("some_string"),
            bundle.getCharSequence("some_char_sequence"),
            bundle.getParcelable("some_parcelable"),
            bundle.getParcelableArrayList("some_parcelable_array_list"),
            bundle.getSparseParcelableArray("some_parcelable_sparse_array"),
            bundle.getSerializable("some_serializable"),
            bundle.getIntegerArrayList("some_integer_array_list"),
            bundle.getStringArrayList("some_string_array_list"),
            bundle.getCharSequenceArrayList("some_char_sequence_array_list"),
            bundle.getByteArray("some_byte_array"),
            bundle.getShortArray("some_short_array"),
            bundle.getCharArray("some_char_array"),
            bundle.getFloatArray("some_float_array"),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
 
Example 11
Project: GitHub   File: Injector.java   View Source Code Vote up 5 votes
public ArrayList<Integer> getIntegerArrayList(Bundle state, String key) {
    return state.getIntegerArrayList(key + baseKey);
}
 
Example 12
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 5 votes
public ArrayList<Integer> getIntegerArrayList(Bundle state, String key) {
    return state.getIntegerArrayList(key + mBaseKey);
}
 
Example 13
Project: android-state   File: BundlerListInteger.java   View Source Code Vote up 5 votes
@Nullable
@Override
public List<Integer> get(@NonNull String key, @NonNull Bundle bundle) {
    return bundle.getIntegerArrayList(key);
}
 
Example 14
Project: NavRouter   File: SubTestActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getBundleExtra("bundle");

    LinearLayout linearLayout = new LinearLayout(this);
    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(linearLayout);

    TextView textView = new TextView(this);
    textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER));
    linearLayout.addView(textView);

    ArrayList<Integer> intList =bundle.getIntegerArrayList("extra");

    StringBuilder stringBuilder = new StringBuilder();

    for(int item:intList){
        stringBuilder.append(item+" ");
    }

    textView.setText("The bundle param is : year -> list:{" +stringBuilder+ "}" );
}
 
Example 15
Project: MyAnimeViewer   File: SelectableAdapter.java   View Source Code Vote up 3 votes
/**
 * Restore the previous state of the selection on the items.
 *
 * @param savedInstanceState
 */
public void onRestoreInstanceState(Bundle savedInstanceState) {
    selectedItems = savedInstanceState.getIntegerArrayList(TAG) != null ? savedInstanceState.getIntegerArrayList(TAG) : selectedItems;
}