Reputation: 53
trying to display this html table
in android app .this image is just a scap.it contains lot of data .here is html structure
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
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