Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android disable onclick event when url links clicked

I have textview which contains urls like www.google.com. for this textview a have also created a onclicklistener.

My problem is when user clickes www.google.com, link is used by an activity, but after that activity onclick event is also created. but i dont want to create onclick events when user clicks on urls .

Is it possible for texview to disable onclick events when user clickes on urls like http://www.google.com, market://android.. etc.

EDIT 1: I added details below.

            TextView entry = (TextView) v
                    .findViewById(R.id.textViewEntryText);
            entry.setText(Html.fromHtml(String.format("%s",
                    (CharSequence) displayText)));
            entry.setMovementMethod(LinkMovementMethod.getInstance());

after creating textview with links then put another events onclick other texts.

            entry.setOnClickListener((new View.OnClickListener() {

                // TODO Auto-generated method stub

                public void onClick(View v) {
                    // TODO Auto-generated method stub

                    }
                }
            }));

Now when user clicks on url link i dont want to other onclick event works for links .

like image 703
Yaya Avatar asked Mar 02 '12 13:03

Yaya


1 Answers

wow. Android is magic. There is a seperate attribute for that:

android:linksClickable:"false"

You can change it in the code, via :

myTextView.setLinksClickable(false);
like image 86
Orkun Ozen Avatar answered Oct 30 '22 23:10

Orkun Ozen