Question: I am trying to change the text color by simply clicking the button but when I click the button it changes the previously typed text color also. Means changes the whole text color. When I try to change color through Spannable then it changes the color of the selected part of the text but not for the text which I am going to type next. Is there a way where I can click the button and it does not change the whole text color but the color for which I type next. Thanks

[![enter image description here](https://i.stack.imgur.com/rd7cn.png)](https://i.stack.imgur.com/rd7cn.png)

here is what I know only

```
redtxt.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View view) {
            str.setSpan(new ForegroundColorSpan(Color.parseColor(txtColor)),     selStart, selEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
               text.setTextColor(Color.parseColor("#d32f2f"));
       }
   });

```

Answer: 
You need to install only one package with neccessary shared object for it to work

```sh
sudo apt-get install libatlas-base-dev

```
Exact same solution as @thvs86 but here's a single 1 line copy-paste so you don't have to insert each command individually:

`pip3 install opencv-contrib-python; sudo apt-get install -y libatlas-base-dev libhdf5-dev libhdf5-serial-dev libatlas-base-dev libjasper-dev libqtgui4 libqt4-test`