is it possible in android to make text view clickable if yes then how ??and if not then what will be the way for make a label clickable??i want to implement a call activity using this
private void call() { try { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+keywordxmlparsing.phone)); startActivity(callIntent); } catch (ActivityNotFoundException activityException) { Log.e("dialing-example", "Call failed", activityException); } }
thanks for ur responses in advance...
This example demonstrates how do I set the part of the Android textView as clickable. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.
Just like Buttons and ImageViews we can add onClickListeners to TextViews by simply adding the attribute android:onClick="myMethod" to your TextView XML tag. <TextView android:layout_width= "wrap_content" android:layout_height= "wrap_content" android:text= "@string/clickTextView" android:onClick= "myMethod" />
then use a link with custom scheme and host in the text of the TextView as (in String.xml): and "activate" the link with setMovementMethod () (in onCreate () for activities or onCreateView () for fragments): This will open the stack activity with a tap on the "stack" word.
While using any social media app or like using Facebook you may have seen there is a particular type of TextView which you cannot copy like a caption that people write on their posts. You can select the message but there few texts which cannot select or copy. So here we are going to learn how to implement that feature. Attention reader!
textView.setOnClickListener(new View.OnClickListener());
Have you tried this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With