M
M
max_vr2016-06-07 23:16:36
Java
max_vr, 2016-06-07 23:16:36

How to access an item from a specific row of a listView?

I'm a newbie, please help me figure it out. To understand the question, I will give an example: let's say I have a listView, 2 text fields in each line, already filled through a simpleAdapter, and there is a button. How to make it so that by clicking on this button, for example, the font color of one specific text field of one specific line of the list changes?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2016-06-07
@GavriKos

The easiest option is to add a tag (setTag) to each button, in which you specify the ID of the list line in which you want to change the color.
In clickListener you get this same tag (getTag), knowing it, you get the list line, well, then you already do what you want with it.

I
IceJOKER, 2016-06-07
@IceJOKER

Answer to question in title - listView.getItemAtPosition(position);
Answer to question below - stackoverflow.com/questions/12596199/android-how-t...
in handler write textView.setColor();
And so - ask specific questions, write what you did and what didn’t work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question