Source code below is not working
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_book_page);
book_page = (EditText) findViewById(R.id.activity_book_page_text);
book_page.setText("Google is your friend.", TextView.BufferType.EDITABLE);
book_page.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
book_page.setSelection( 9, 15);
//book_page.requestFocus();
}
});
book_page.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v, boolean hasFocus){
if (hasFocus){
book_page.setSelection( 9, 15);
}
}
});
<EditText
android:id="@+id/activity_book_page_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:ems="10"
android:inputType="textMultiLine"
android:selectAllOnFocus="true" >
<requestFocus />
</EditText>