在Eclipse的意图不能被解析为一个类型“的错误意图、错误、类型、Eclipse

2023-09-06 09:43:38 作者:Fleshy呆橘

我编程的第一个安卓教程在eclipse中,并编写本code时:

I am programming the first android tutorial in eclipse, and when compiling this code:

Intent intent = getIntent();

它给人的错误

it gives the error

意图不能被解析为一个类型

Intent cannot be resolved to a type

如何解决呢?

推荐答案

也许,进口语句丢失。尝试pressing 控制 + 移 + 0 ,Eclipse会自动如果缺少添加import语句。

Probably, the import statement is missing. Try pressing Ctrl+Shift+O, Eclipse will automatically add the import statement if missing.

再来看一下文件的顶部,看看已被添加。它应该是这样的:

Then look at the top of the file and see what has been added. It should be something like this:

import android.content.Intent;