如何列出捆绑包中的所有KEYS?

时间:2014-05-17 07:51:19

标签: android android-intent bundle

我尝试了以下代码,但仍然没有找到列出捆绑中所有包含的密钥的方法。

JavaCode:

private void unpackBundle() {
    // TODO Auto-generated method stub
    Set <String> mBundleKeysSet = this.mBundle.keySet();
    int size = mBundleKeysSet.size();
    Toast.makeText(getApplicationContext(), size+" keys",Toast.LENGTH_LONG).show();
    if ( mBundleKeysSet.iterator().hasNext() ) {
        //here i should display a list of the contained keys
                    //in the bundle
    }
}

1 个答案:

答案 0 :(得分:0)

实际上,我找到了答案:

private void unpackBundle() {
// TODO Auto-generated method stub
Set <String> mBundleKeysSet = this.mBundle.keySet();
int size = mBundleKeysSet.size();
Toast.makeText(getApplicationContext(), size+" keys",Toast.LENGTH_LONG).show();

toast.makeText(getApplicationContext(), mBundleKeysSet.toString() 
               ,Toast.LENGTH_LONG).show();

}