intent.getStringExtra()返回null,但字符串!= null是真的吗?安卓 [英] intent.getStringExtra() returns null but String != null is true? Android

查看:484
本文介绍了intent.getStringExtra()返回null,但字符串!= null是真的吗?安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道这到底是引擎盖下怎么回事时,多余的意图不首先存在吗?

I am just wondering what the hell is going on under the hood when the intent extra doesn't exist in the first place?

例如:

String remindOnString = intent.getStringExtra(NoteExtrasKey.EXTRA_NOTE_REMINDON);

if(remindOnString != null && !remindOnString.equals(""))
    mRemindDateTime = Timestamp.valueOf(remindOnString);

这是很奇怪,我前pression:! remindOnString = NULL 是真的尽管remindOnString接收空的事实

It is quite strange to me the expression: remindOnString != null is true despite the fact that remindOnString receives null.

下面是我为这个变量设置手表的屏幕截图:

Here is the screenshot of the watches I set for this variable:

我不知道如果我错过了从文档的东西。但是,这是很奇怪的我。根据该工具提示(我相信从API-文档) intent.getStringExtra(KEY)返回字符串或空。

I don't know if I missed something from the documentation. But this is very strange to me. According to the tool-tip (Which I believe from the api-docs) intent.getStringExtra(KEY) returns the string or null.

什么样的​​巫术是什么?

What kind of sorcery is this?

推荐答案

它返回值空,但仍然是一个对象。

It returns value "null" but still a object .

这篇关于intent.getStringExtra()返回null,但字符串!= null是真的吗?安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆