How to change the color of an item or of the entire Backgroud of a listView by onActivityResult?

Asked

Viewed 37 times

1

It seems I can only change the color of an item in onItemClick() and the full background color when populated ListView.

Does anyone know how to do that? What I needed was to click on an item from the Activity A, open a form on Activity B and after giving a finish() in Activity B, change the color of the Activity The one I just filled out the form.

2 answers

0

0

Change the color of the list:

    ListView lV = null;
    lV = getListView();
    lV = (ListView) findViewById(R.id.mylist); // Nome da sua listView
    lV.setBackgroundColor(Color.WHITE); // SUA COR

Change the color of a row in the list:

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
    View view = super.getView(position, convertView, parent);
    if (highlightedPositions.contains(position)) {
    view.setBackgroundColor(Color.WHITE); // SUA COR
    }
    return view;
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.