I am retrieving android apps icons using this code :
Drawable icon = icon = p.applicationInfo.loadIcon(context.getPackageManager());
where p is PackageInfo
class object.
I have implemented a server for android which handles requests and responses by client. Here when I send a GET request
from client that is my browser, server generates a html page.
Problem is that I need to display retrieved android installed App Icons on html page and I used the following code to do that:
returnHtml += "<tr>";
returnHtml += "<td><img src=" + icon +" /></td>";
returnHtml += "<td>" + apps[0] + "</td>";
returnHtml +="<td>" + apps[1] + "</td>";
returnHtml += "<td>" + apps[2] + "</td>";
returnHtml +="<td>" + apps[3] + "</td>";
returnHtml +="</tr>";
Basically, here I am generating a table row with respective app info and displaying respective App icons in first column.But it's not showing respective App icons instead displaying default icon image (small image with a question mark on it).
"icon" is a "Android Drawable" class object. Do I need to convert retrieved icon to some form or I need to store icon in some folder first ?
As my html pages are stored in assets
folder which is not writable I can't store icon images there. Is there any solution to display icon images directly from drawable object only ?