我正在尝试从包名称中获取图标。包名通过套接字传递给我。我正在获取包名称并尝试使用它来获取图标,但它引发了异常。我从来没有得到图标的打印声明。任何想法为什么?
try {
Socket socket = new Socket("192.170.10.15", 5050);
DataInputStream DIS = new DataInputStream(socket.getInputStream());
String packagename = DIS.readUTF();
System.out.println("package name" + packagename);
Drawable icon = getPackageManager().getApplicationIcon(packagename);
System.out.println("icon" + icon);
socket.close();
} catch (Exception e) {
System.out.println("Did not receive string");
}
抛出的异常是:我现在的异常,当我想要“Iso Mounter”应用程序的图标时,是:
Exception is android.content.pm.PackageManager$NameNotFoundException: com.iso.mounter –