开发者

What is ActivityInfo meta data?

开发者 https://www.devze.com 2023-02-09 16:56 出处:网络
What is ActivityInfo\'s meta data? Bundle bundle开发者_JAVA技巧 = actInfo.metaData; What kind of data bundle contains and how to retrieve data from Bundle if no key pair known?

What is ActivityInfo's meta data?

Bundle bundle开发者_JAVA技巧 = actInfo.metaData;

What kind of data bundle contains and how to retrieve data from Bundle if no key pair known?

Thanks


It's whatever meta data was specified in the Activity's manifest.

<activity>
    <meta-data android:name="key" android:value="value" />
    <meta-data android:name="key2" android:resource="@string/res" />
</activity>

http://developer.android.com/guide/topics/manifest/meta-data-element.html

Bundle has a method called keySet which returns Set<String>. With that, you can iterate through all the data with Bundle.getString, getInt, getBoolean, getFloat. I don't think there is a way to know the correct/intended data type though.

0

精彩评论

暂无评论...
验证码 换一张
取 消