Sunday, July 17, 2022

[FIXED] How to play animated GIF image from url in android?

Issue

I am integrating giphy to my android app..

How can i play animated gif image from URL in android? Should I use ImageView, WebView, VideoView etc? For example if i want to play animation from this URL.


Solution

Just create a html string and load that into android webview. Tested solution.

http://developer.android.com/reference/android/webkit/WebView.html#loadData(java.lang.String, java.lang.String, java.lang.String)

 String x = "<!DOCTYPE html><html><body><img src=\"http://goo.gl/uPJ9P2\" alt=\"Smileyface\" width=\"100%\" height=\"100%\"></body></html>";

 webView.loadData(x, "text/html", "utf-8");   


Answered By - Rohit Sharma
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.