android - Selecting text in textview -
i have 2 textview , want implement textselection feature in both textview. api version 15 , above. xml both textview same. in code, have called method,
tv1.setcustomselectionactionmodecallback(new callback() { public boolean onprepareactionmode(actionmode mode, menu menu) { // todo auto-generated method stub return false; } public void ondestroyactionmode(actionmode mode) { // todo auto-generated method stub } public boolean oncreateactionmode(actionmode mode, menu menu) { // todo auto-generated method stub return true; } public boolean onactionitemclicked(actionmode mode, menuitem item) { // todo auto-generated method stub return false; } }); tv2.setcustomselectionactionmodecallback(new callback() { public boolean onprepareactionmode(actionmode mode, menu menu) { // todo auto-generated method stub return false; } public void ondestroyactionmode(actionmode mode) { // todo auto-generated method stub } public boolean oncreateactionmode(actionmode mode, menu menu) { // todo auto-generated method stub return true; } public boolean onactionitemclicked(actionmode mode, menuitem item) { // todo auto-generated method stub return false; } });
when run code, able select first textview not able select second textview. getting logcat message textview not selectable, action mode cancelled. have gone through links not able resolved issue.
the xml structure both textview same.
i have added the: tv1.settextisselectable(true); tv2.settextisselectable(true);
Comments
Post a Comment