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

The following examples show how to use android.content.Intent#getCharExtra() . These examples are extracted from open source projects. 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 Project: Shield   File: IntentUtils.java    License: MIT License 6 votes vote down vote up
public static char getCharParam(String name, char defaultValue, Fragment fragment) {
    if (fragment.getArguments() != null && fragment.getArguments().containsKey(name)) {
        return fragment.getArguments().getChar(name);
    }

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

    return i.getCharExtra(name, defaultValue);

}
 
Example 2
public static CsvImportOptions fromIntent(Intent data) {
    WhereFilter filter = WhereFilter.fromIntent(data);
    Currency currency = CurrencyExportPreferences.fromIntent(data, "csv");
    char fieldSeparator = data.getCharExtra(CsvImportActivity.CSV_IMPORT_FIELD_SEPARATOR, ',');
    String dateFormat = data.getStringExtra(CsvImportActivity.CSV_IMPORT_DATE_FORMAT);
    long selectedAccountId = data.getLongExtra(CsvImportActivity.CSV_IMPORT_SELECTED_ACCOUNT_2, -1);
    String filename = data.getStringExtra(CsvImportActivity.CSV_IMPORT_FILENAME);
    boolean useHeaderFromFile = data.getBooleanExtra(CsvImportActivity.CSV_IMPORT_USE_HEADER_FROM_FILE, true);
    return new CsvImportOptions(currency, dateFormat, selectedAccountId, filter, filename, fieldSeparator, useHeaderFromFile);
}
 
Example 3
public static CsvExportOptions fromIntent(Intent data) {
    WhereFilter filter = WhereFilter.fromIntent(data);
    Currency currency = CurrencyExportPreferences.fromIntent(data, "csv");
    char fieldSeparator = data.getCharExtra(CsvExportActivity.CSV_EXPORT_FIELD_SEPARATOR, ',');
    boolean includeHeader = data.getBooleanExtra(CsvExportActivity.CSV_EXPORT_INCLUDE_HEADER, true);
    boolean exportSplits = data.getBooleanExtra(CsvExportActivity.CSV_EXPORT_SPLITS, false);
    boolean uploadToDropbox = data.getBooleanExtra(CsvExportActivity.CSV_EXPORT_UPLOAD_TO_DROPBOX, false);
    return new CsvExportOptions(currency, fieldSeparator, includeHeader, exportSplits, uploadToDropbox, filter, true);
}
 
Example 4
Source Project: Ticket-Analysis   File: IntentUtil.java    License: MIT License 4 votes vote down vote up
public static char getCharExtra(Intent intent, String name, char defaultValue) {
    if (!hasIntent(intent) || !hasExtra(intent, name)) return defaultValue;
    return intent.getCharExtra(name, defaultValue);
}
 
Example 5
Source Project: OnActivityResult   File: IntentHelper.java    License: Apache License 2.0 4 votes vote down vote up
public static char getExtraChar(final Intent intent, final String key, final char defaultValue) {
    return intent.getCharExtra(key, defaultValue);
}