i am trying to get some info (name and icon) from a non installed app. Basically o got the apk file, i didn't installed it yet, but i would like to display its name and icon in a list.
I am trying to do this :
public void getReceivedApps() {
    packageManager = getPackageManager();
    System.out.println("TRANSFER-RECORDActivityThe received filePath is : " + receivedFilePath);
    PackageInfo packageInfo = packageManager.getPackageArchiveInfo(receivedFilePath, PackageManager.GET_GIDS);
    System.out.println("TRANSFER RECORD ACTIVYT : O TO STRING TO PACKAGE INFO : " + packageInfo.toString());
    ApplicationInfo applicationInfo = packageInfo.applicationInfo;
    Log.d(this.getClass().getName(), "packaginf0 : " + applicationInfo.toString());
    String appName = applicationInfo.loadLabel(packageManager).toString();
    System.out.println("TRANSFER RECORD ACTIVITY  : THE APPNAME IS : " + appName);
    Drawable icon = packageManager.getPackageArchiveInfo(receivedFilePath, PackageManager.GET_GIDS).applicationInfo.loadIcon(packageManager);
    //then add it to a list.
}
The problem and it is giving me a nullpointerexception in the loadIcon and loadLabel instructions.
Btw, the receivedFilePath string has the filepath to that apk file (which is 
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/"+getIntent().getStringExtra("receivedFilePath"); ) 
And this receivedFilePath sent as a string has the name of the file (not the app)