如何从一个函数传递不同类型的几个变量到另一个android上?
问题描述:
我有getFilmsBrowse功能,它应该返回以下字段:
I have getFilmsBrowse function and it should return the following field:
- 名称(字符串)
- 描述(字符串)
- 一年(INT)
- 等
该函数的结果。
我怎样才能通过他们,并能够在displayMovies使用的字段的名称?
想用地图
的相同,但目前尚不清楚对我如何初始化。
Results of this function to be used in another function displayMovies.
How can I pass them and be able to use names of fields in displayMovies?
Wanted to use Map
for the same, but it is not clear for me how to initialize that.
答
您可以使用捆绑
类此。这就像一个地图
,但它可以包含不同类型的值。
You can use Bundle
class for this. It's like a Map
, but it can contain values of different types.