0

With my ListView in Android Application made in Eclipse:

ArrayList<String> planetList = new ArrayList<String>();
planetList.addAll(Arrays.asList(xRemote));

listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow,
        R.id.rowTextView, planetList);          

listAdapter.addAll(xRemote);
mainListView.setAdapter(listAdapter);

Get this output:

https://www.LinkFromImageonTheGoogle.net/myImage.png
23/03/2014
<a href=http://www.mywebpage.net?ID=764>My remote pics</a>

https://www.LinkFromImageonTheGoogle.net/myImage1.png
22/03/2014
<a href=http://www.mywebpage.net?ID=765>My remote pics 1</a>

https://www.LinkFromImageonTheGoogle.net/myImage2.png
21/03/2014
<a href=http://www.mywebpage.net?ID=766>My remote pics 2</a>

How can I format this output in html?

4
  • i don't understand what you are trying to do Commented Apr 11, 2014 at 19:38
  • Have a look at Html.fromHtml() developer.android.com/reference/android/text/… Commented Apr 11, 2014 at 19:39
  • I need html output on ListView ... Commented Apr 11, 2014 at 19:41
  • listAdapter.addAll(Html.fromHtml(xRemote.toString())); The method addAll(Collection<? extends String>) in the type ArrayAdapter<String> is not applicable for the arguments (Spanned) Commented Apr 11, 2014 at 19:50

1 Answer 1

1

Your best bet is to create a custom View for each ListItem based on the HTML response (e.g., an ImageView positioned next to a Textenter code hereView, with link behaviors, etc), but you could technically use a WebView for each ListItem, but that'd be pretty inefficient.

To provide a custom View (or ViewGroup), you provide your own implementation of an Adapter class, and override the appropriate methods. For example, you might create a custom class that extends BaseAdapter (probably the most flexible option), and override the getView method to return the appropriate set of elements. There are many tutorials and examples for custom ListViews with Adapters all over the net and the Android docs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.