eclipse中的“意图无法解析为类型"错误 [英] 'Intent cannot be resolved to a type' error in eclipse

查看:32
本文介绍了eclipse中的“意图无法解析为类型"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写第一个 android 教程 在 Eclipse 中,并在编译此代码时:

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

Intent intent = getIntent();

它给出了错误

Intent 无法解析为类型

Intent cannot be resolved to a type

我该如何解决?

推荐答案

可能缺少 import 语句.尝试按 Ctrl+Shift+O,Eclipse 会自动添加导入语句.

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;

这篇关于eclipse中的“意图无法解析为类型"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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