In my fragment I used one layout. In that, for one textview I need to provide the copy option.
<TextView
android:id="@+id/txtShareWinurl"
style="@style/matchWidth"
android:layout_height="@dimen/dimen_fifty"
android:layout_gravity="center"
android:layout_margin="@dimen/dimen_ten"
android:background="@drawable/verylight_gray_bg_border"
android:gravity="center"
android:padding="@dimen/dimen_five"
android:text="@string/app_name"
android:textColor="@color/gray_code"
android:textSize="@dimen/dimen_fifteen"
android:textIsSelectable="true"
android:textStyle="bold" />
In that I used textIsSelectable
than i got the window with copy and selectall options. But when i click on that option i need to display a toast. Please help me.
I tried and google some links but I didn't succeed.
It depends on your scenario, but you can detect the clipboard-change with ClipboardManager:
ClipbardManager Documenation
Example code: