Home » Android » android – How to enumerate key value pairs of a bundle

android – How to enumerate key value pairs of a bundle

Posted by: admin June 15, 2020 Leave a comment

Questions:

Does anyone know of a way to enumerate all of the key value pairs of a bundle without knowing ahead of time all the keys?

How to&Answers:

I think the only way to get all they key-value pairs is to enumerate through keys using keySet() and then get() its relative value. For example:

for(String key : bundle.keySet()){
    Object obj = bundle.get(key);   //later parse it as per your required type
}