简体   繁体   English

如何为我的android项目添加javax.swing。*包到我的libs?

[英]How do I add the javax.swing.* packages to my libs for my android project?

First of all I'd like to mention I am very new to Java programming. 首先,我想提一下我是Java编程的新手。 This Android project is my first experience with Java. 这个Android项目是我第一次使用Java。 So for one task I need to strip HTML tags from a string. 因此,对于一项任务,我需要从字符串中删除HTML标记。 I was thinking about using this answer Remove HTML tags from a String to do this task. 我正在考虑使用此答案从String中删除HTML标记来执行此任务。 In order to do this I need to be able to import javax.swing.text.html.* and javax.swing.text.html.parser.*. 为了做到这一点,我需要能够导入javax.swing.text.html。*和javax.swing.text.html.parser。*。

I went to the properties of my project and attempted to add this library to my project. 我转到我的项目的属性,并尝试将此库添加到我的项目。 I read that this was included in the rt.jar file which was located at /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar 我读到它包含在rt.jar文件中,该文件位于/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar

I was able to use the imports but it seems like it added a million libraries I am not using. 我能够使用导入,但似乎它增加了一百万个我没有使用的库。 Will this negatively effect my application? 这会对我的申请产生负面影响吗? What is the correct way to add just the one extension? 添加一个扩展名的正确方法是什么?

You don't. 你没有。 Android doesn't use Swing. Android不使用Swing。 You'll need to use Android's API to create your UI and perform text parsing. 您需要使用Android的API来创建UI并执行文本解析。 Consider android.text.Html as a simple way to strip HTML from a string. android.text.Html视为从字符串中删除HTML的简单方法。

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

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