简体   繁体   English

java.awt.event无法解析

[英]java.awt.event cannot be resolved

I have the error java.awt.event cannot be resolved in the statement: 我在语句中无法解决错误java.awt.event

import java.awt.event.ActionListener;

I'm writing an android application that fires an action (by extending the AbstractAction class) when an SMS is received. 我正在编写一个Android应用程序,该应用程序会在收到SMS时触发一个动作(通过扩展AbstractAction类)。 I'm implementing the ActionListener interface in another class. 我正在另一个类中实现ActionListener接口。

EDIT 编辑

The above issue is resolved. 以上问题已解决。 Now which classes shall I use that'll let me fire actions like in java swing. 现在,我应该使用哪些类,这将使我触发类似于java swing的动作。 Or shall I use another way? 还是我应该使用其他方式? I basically need to call a method on another thread. 我基本上需要在另一个线程上调用一个方法。

I'm writing an android application 我正在编写一个android应用程序

Well that's the problem then... Android doesn't support the whole of the AWT; 那么那就是问题所在……Android不支持整个AWT。 it has its own GUI libraries. 它有自己的GUI库。 See the platform reference documentation for details. 有关详细信息,请参见平台参考文档 It's not clear which AbstractAction class you're talking about, either - is it a third-party one? 您还不是在谈论哪个AbstractAction类-它是第三方类吗? If so, look at that third-party documentation to see whether another library is required for AWT-like classes. 如果是这样,请查看该第三方文档,以了解类似AWT的类是否需要另一个库。

Have you looked at whether what you're trying to do might be better achieved using the "normal" Android platform API instead? 您是否查看过尝试使用“常规” Android平台API更好地实现您的目的吗? I'd expect that to be simpler. 我希望这会更简单。

Java Standard Edition - (AWT + SWING) = Android.

The above statement means that Android doesn't support Swing and AWT from Java SE. 以上声明意味着Android不支持 Java SE中的Swing and AWT Android provides its own GUI library, i think usage of GUI in android is far more easier to construct. Android提供了自己的GUI库,我认为在Android中使用GUI更加容易构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM