intent.getStringExtra()返回null,但字符串!= null是真的吗?安卓字符串、intent、getStringExtra、null

2023-09-07 09:49:51 作者:cardiac(心动)

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

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 .