TextView Clickeable Android Studio

0

I need to make a TextView Clickeable, but the text of this is not always the same so I can not hardcode it in the xml, so I need to assign it dynamically, I do it this way:

aux = (TextView) findViewById(R.id.tvPagWeb);
aux.setText(c.getString(0)); //Cursor c saca la pag web de una base de datos
aux.setClickable(true);

But the text is gray and you can not click it.

    
asked by Franco Rolando 19.11.2018 в 22:36
source

2 answers

0

The solution was to put in the .xml of the activity you should put: autoLink: "all" or "web" // It depends on the taste of each one, or for what you use it //beside: clickable="true"

I forgot to put autoLink, I hope it works for them.

    
answered by 19.11.2018 / 22:50
source
1

one way is like this:

 aux.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // tu código
        }
    });
    
answered by 19.11.2018 в 22:40