I have a requirement like when user click on edit text only it should be in the editable mode other wise non editable mode. And after editing the text need to remove the cursor and the updated text should be visible to Edit text. Please share me any idea.
How I implemented is: my edittext xml
<EditText
android:layout_weight="1"
android:id="@+id/namevalue"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="@font/robotobold"
android:text="ABC"
android:focusable="false"
android:cursorVisible="false"
android:background="@android:color/transparent"
android:textSize="14sp"
android:textColor="@color/colortextw"
/>
And My Java code
nameval.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
nameval.setCursorVisible(true);
nameval.setFocusable(true);
nameval.setFocusableInTouchMode(true);
nameval.requestFocus();
}
});
But the problem is, the cursor is not moving from the edit text after editing and when I move to the next page and came back to the same page the updated edit text is not showing in the edit text