android - How to display every other string within View getView()? -


I have created a custom adapter that accepts an ArrayList. ArrayList has a title and then a link.

For example: [Title 1, Title 2, -, Title 3, - ...] ** I have inserted hyphens because of the "Stackworflow" spam filter.

I 'I want to display the title and then there is a link to click on the link. I'm having trouble but finding out a way to do this. Any help would be greatly appreciated! :)

ArrayList must include link objects.

Ex.

  class links {string title; String url; }  

In the getView of your adapter you will use the title to fill the TextView and onClick on onSelect or whatever, you will have a link object with the title and URL.

East.

  See public getView (see index, seeviewview, ViewGroup parent) {TextView tv = (TextView) Convertview; Link link = list.get (index); Tv.setText (link.getTitle ()); Return TV; } Public Zero onItemClick (ViewGroup Parent, View View, Integer Status, Long ID) {link link = list.get (status); String uri = link.getUri (); // something interesting to do}  

And if your adapter extends to the arrayhead and you are not overriding getView (), then the toString () method of the link needs to return the title field is.


Comments