user1987430
user1987430

Reputation: 53

How to display html table in android screen(not in web view)

trying to display this html table enter image description here

in android app .this image is just a scap.it contains lot of data .here is html structure enter image description here based on this structure i want to display above table in android app i tried by placing all dt tags static and displaying dd tags with following code

String[] ddsTexts = new String[dds.size()];
            List l = new ArrayList();
            for (int i = 0; i < dds.size(); i++) {
                ddsTexts[i] = dds.get(i).ownText();
                System.out.println(ddsTexts);
                l.add(ddsTexts[i]);
            }

.but it is not working if table format is changing .irrespective of table content ,i want to display it on android screen based on structure.how can i do it.thanks

Upvotes: 0

Views: 1573

Answers (1)

Bryan Herbst
Bryan Herbst

Reputation: 67189

The direct answer to your question: You cannot use HTML tables outside of WebViews. In general, HTML doesn't belong in an Android app outside of WebViews and some limited formatting (e.g. <strong> or <em> tags) in TextViews.

The problem with your provided code: You are using System.out.println to try to output the HTML. This simply logs the line to the logcat (and not in a standard way either). Android relies on layouts and Views to present the user interface.

If you don't want to use a WebView, the most appropriate method of displaying a table would be to parse the data and display it in a TableLayout.

Upvotes: 1

Related Questions