Java Code Examples for android.content.Intent#getByteExtra()

The following examples show how to use android.content.Intent#getByteExtra() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntentUtils.java    From Shield with MIT License 6 votes vote down vote up
public static byte getByteParam(String name, byte defaultValue, Fragment fragment) {
    if (fragment.getArguments() != null && fragment.getArguments().containsKey(name)) {
        return fragment.getArguments().getByte(name);
    }

    Intent i = fragment.getActivity().getIntent();
    try {
        Uri uri = i.getData();
        if (uri != null) {
            String val = uri.getQueryParameter(name);
            if (!TextUtils.isEmpty(val))
                return Byte.parseByte(val);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return i.getByteExtra(name, defaultValue);
}
 
Example 2
Source File: IntentUtil.java    From Ticket-Analysis with MIT License 4 votes vote down vote up
public static byte getByteExtra(Intent intent, String name, byte defaultValue) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return defaultValue;
    return intent.getByteExtra(name, defaultValue);
}
 
Example 3
Source File: IntentHelper.java    From OnActivityResult with Apache License 2.0 4 votes vote down vote up
public static byte getExtraByte(final Intent intent, final String key, final byte defaultValue) {
    return intent.getByteExtra(key, defaultValue);
}