copying and pasting image in Edittext

I am on the project RichTextEditor and completed almost all functionality. I can insert image and can save the file with image and also getting the image and all styles while opening the file again.I am stuck at one point ie. when copying all the content of the Edittext, while pasting except Image all things got paste, but in image area i got like this
enter image description here

any idea or workaround to copy and paste the image.

  • How to cancel Handler in code?
  • error with setPixels
  • How to show Certain Part of WebPage inside Webview With Fit Screen to All Devices
  • Parallax XY and rotation - tile calculation
  • Recyclerview + Content provider + CursorLoader
  • Heterogeneous GridLayout
  • Total arena pages for JIT - what does it mean?
  • Android - Adding and showing items to ListView one at a time using an ArrayAdapter
  • Is it possible, in principle, for an Android device to interface with an iPhone over Bluetooth/GameKit?
  • Android NDK Native method not found error
  • Xamarin.Android builds/deployments are very slow. How to speed them up?
  • Rxjava and Volley Requests
  • 2 Solutions collect form web for “copying and pasting image in Edittext”

    I have the same problem. After get the editText field’s string, I find the “obj” character, and then replace it with image’s link. I created a ArrayList to store the images’ links. And moreover, I think I need to catch the delete action. If an image is deleted, I deleted its link in the image list. Below is the code I use to replace the “obj” character.

    private String replaceSpecialCharactorFromNote(){
        String noteString = edt_note.getText().toString();
        char[] noteCharacters = noteString.toCharArray();
        for(int i=0; i<noteCharacters.length; i++){
            if((int)noteCharacters[i] <1 || (int)noteCharacters[i]>254 ){//compare the ascii code
                Log.i("the first abnormal charactor is ", "" + noteCharacters[i]);
                if(imageIndex < imgsList.size()){
                    Log.i("replace triggered", "special char index is "+i);
                    Log.i("replace triggered", "replaced image index is "+imageIndex);
                    Log.i("replace triggered", "image is "+imgsList.get(imageIndex));
                    String beforeString = noteString.substring(0, i);
                    String afterString = noteString.substring(i+1);
                    noteString = beforeString + imgsList.get(imageIndex) + afterString; 
                    Log.i("replace triggered", "note is "+noteString);
        return noteString;

    Overall, I do not think the way I did is the best way to solve the problem. The best way probably will be to create a custom field to handle it.

    Did you check the content on the clipboard? How is the image handled in the clipboard? You will have to make your RichTextView handle the paste operation (is the image copied as a bimap / are you referencing a path to the bitmap) from the clipboard.

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