Android-Rich-text-Editor icon indicating copy to clipboard operation
Android-Rich-text-Editor copied to clipboard

Image is not shown in editor

Open tajanthind opened this issue 6 years ago • 3 comments

Everything works fine but when i try to add image or video in the editor, it doesn;t show the image or video.

One question: How to I covert html into original text and show it in a textview or arEdittext but without letting user to edit it.

tajanthind avatar Aug 03 '19 12:08 tajanthind

Hi, sorry for late response.

I double-tested, image and video work for me, they can be shown in the editor.

For your question, you can use the sample code in AREditor.java to get the Spanned object and set to your TextView.

public void fromHtml(String html) {
        Html.sContext = mContext;
        Html.ImageGetter imageGetter = new AreImageGetter(mContext, this.mAre);
        Html.TagHandler tagHandler = new AreTagHandler();
        Spanned spanned = Html.fromHtml(html, Html.FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH, imageGetter, tagHandler);
        this.mAre.getEditableText().append(spanned); // Here, replace mAre with TextView
    }

chinalwb avatar Aug 05 '19 13:08 chinalwb

Thanks for replying sir. I will tell you if this work. I also wanna know that can I upload an image entered by user to firebase and save that url in areditor. And if i can , how do i display the image from url using glide or picasso?

On Mon, Aug 5, 2019, 6:40 PM Rain Liu, [email protected] wrote:

Hi, sorry for late response.

I double-tested, image and video work for me, they can be shown in the editor.

For your question, you can use the sample code in AREditor.java to get the Spanned object and set to your TextView.

public void fromHtml(String html) { Html.sContext = mContext; Html.ImageGetter imageGetter = new AreImageGetter(mContext, this.mAre); Html.TagHandler tagHandler = new AreTagHandler(); Spanned spanned = Html.fromHtml(html, Html.FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH, imageGetter, tagHandler); this.mAre.getEditableText().append(spanned); // Here, replace mAre with TextView }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chinalwb/Android-Rich-text-Editor/issues/82?email_source=notifications&email_token=AMO26YLSQKZWGSWQUCE37P3QDARDNA5CNFSM4IJC5SN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3RYNUA#issuecomment-518227664, or mute the thread https://github.com/notifications/unsubscribe-auth/AMO26YNFR5IPPJYEQEZRXK3QDARDNANCNFSM4IJC5SNQ .

tajanthind avatar Aug 05 '19 14:08 tajanthind

There's an interface called ImageStrategy. Your work is have your implementation to do upload and probably you get a URL so that you can show the image.

chinalwb avatar Aug 06 '19 04:08 chinalwb