How do I add the javax.swing.* packages to my libs for my android project?
Asked Answered
G

1

1

First of all I'd like to mention I am very new to Java programming. This Android project is my first experience with Java. So for one task I need to strip HTML tags from a string. I was thinking about using this answer Remove HTML tags from a String to do this task. In order to do this I need to be able to import javax.swing.text.html.* and 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

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?

Grantham answered 19/11, 2010 at 22:48 Comment(0)
E
4

You don't. Android doesn't use Swing. You'll need to use Android's API to create your UI and perform text parsing. Consider android.text.Html as a simple way to strip HTML from a string.

Eleonoreleonora answered 19/11, 2010 at 22:55 Comment(2)
Right, but I need the javax.swing.text.html packages to strip html tags.Grantham
How about using something that Android has? android.text.Html can do a blanket-strip of all tags, javax.xml.parsers.SAXParser is a complex parser (which is probably overkill for your purposes).Eleonoreleonora

© 2022 - 2024 — McMap. All rights reserved.