public boolean hasExtra (String name)
Added in
API level 1
Returns true if an extra value is associated with the given name.
Parameters
| name | the extra's name |
|---|
Returns
- true if the given extra is present.
Intent intent = getIntent();
Log.i("TAG1", intent.hasExtra("x") + "");
Log.i("TAG1", intent.hasExtra("y") + "");
Log.i("TAG1", intent.hasExtra("z") + "");个人理解是判断intent传值过来是否包含上一个页面的key值
文档解释
本文探讨了如何使用Java中的Intent类来判断是否有特定的额外参数(extras)被传递,通过示例代码展示了如何实现这一功能,并解释了其在应用程序间数据传递过程中的应用。

1274

被折叠的 条评论
为什么被折叠?



