Learn how to extract icons from APK files
As /sdcard/**.apk/res/drwable-hdpi-v4/ic_launcher.png, this is
It says it's not a file.
I think it's troublesome to treat zipfile as a file.
You can deploy (or rebuild) apk files using apktool.
You need a Java environment to run.
https://ibotpeaches.github.io/Apktool/install/
>apktooled-s TARGET.apk-o OUTDIR
If you want to retrieve it from the Android app,
String APKFilePath="mnt/sdcard/myapkfile.apk";
PackageManager pm = getPackageManager();
PackageInfo = pm.getPackageArchiveInfo (APKFilePath, 0);
pi.applicationInfo.sourceDir=APKFilePath;
pi.applicationInfo.publicSourceDir=APKFilePath;
Drawable APKicon=pi.applicationInfo.loadIcon(pm); //icon
String AppName=(String)pi.applicationInfo.loadLabel(pm); // App name
APKicon is a drag, so it can be used as setIcon() in Dialog
© 2024 OneMinuteCode. All rights reserved.