如何枚举bundle的键值对

Roy*_*ley 7 android bundle enumeration

有没有人知道如何在不事先知道所有密钥的情况下枚举捆绑的所有键值对?

waq*_*lam 16

我认为获得所有键值对的唯一方法是使用键枚举键keySet()然后枚举get()其相对值.例如:

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