How to get selected text from edittext in android?

I have a edittext in which some text are selected . I want to get only selected text from edittext on click of button .

Please suggest me usable link or sample code.

  • How to enable Heap updates on my android client
  • steam login using openID in android
  • cannot convert from to
  • How to compile a C program for Genymotion (Android x86)
  • Create PKCS#12 file with self-signed certificate via OpenSSL in Windows for my Android App
  • Android Proguard skip external jar
  • Related posts:

    Android WebView renders blank/white, view doesn't update on css changes or HTML changes, an...
    How to put variable inside string-resources?
    Android Studio Keyboard Shortcut for full screen mode
    What is the purpose of Looper and how to use it?
    Should I give params to the constructor or to AsyncTask.execute(params)?
    Android: onListItemClick in Activity
  • Android Project: How best to organize the files
  • Android Resource ID
  • Difference between Adapter and Loader in Android
  • Show AlertDialog in any position of the screen
  • Android In App Purchase Order Status Chargeable
  • Android In-App billing item price
  • 2 Solutions collect form web for “How to get selected text from edittext in android?”

    EditText et=(EditText)findViewById(;
    int startSelection=et.getSelectionStart();
    int endSelection=et.getSelectionEnd();
    String selectedText = et.getText().toString().substring(startSelection, endSelection);

    see this link

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.