[英]Running a non-Activity class
I have more of a understanding problem. 我还有更多的理解问题。 I added a new class in my Android porject. 我在Android项目中添加了一个新类。 The class is not an Activity class, it uses objects of also non-activity classes to get some information. 该类不是活动类,它使用非活动类的对象来获取一些信息。 However, I can not test, if it does its job. 但是,我无法测试,是否可以正常工作。 I can not debug it, none of the Log- messages that I built in the code show up in logcat. 我无法调试它,我在代码中构建的Log-消息都不会显示在logcat中。 How can I test a class in a project otherwise? 否则我如何在项目中测试课程?
I have pretty limited knowledge in java+Android+Eclipse, so I don't know, which one is the issue here. 我对Java + Android + Eclipse的了解非常有限,所以我不知道,这是这里的问题。
Please help. 请帮忙。
创建测试Activity
,在其中添加一些UI元素,以对non-Activity class
逻辑处理,然后对其进行测试
Add a class with 使用添加课程
public static void main(String[] args)
and run it. 并运行它。
Eg 例如
public class Runner {
public static void main(String[] args) {
//do smth here
}
} }
您只需开发带有触发班级功能的按钮的基本活动即可
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.