Java Code Examples for android.content.Intent.toString()

The following are Jave code examples for showing how to use toString() of the android.content.Intent 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: BlackList   File: SMSProcessService.java   View Source Code Vote up 7 votes
private Map<String, String> extractMessageData(@Nullable Intent intent) throws IllegalArgumentException {
    Map<String, String> data = new HashMap<>();
    if (intent != null) {
        String[] keys = intent.getStringArrayExtra(KEYS);
        String[] values = intent.getStringArrayExtra(VALUES);
        if (keys != null && values != null && keys.length == values.length) {
            for (int i = 0; i < keys.length; i++) {
                data.put(keys[i], values[i]);
            }
        }
    }

    if (data.isEmpty()) {
        String intentString = (intent == null ? "null" : intent.toString());
        throw new IllegalArgumentException("Message intent data is illegal: " + intentString);
    }

    return data;
}