Code example for PackageManager.NameNotFoundException

Methods: getMessage

0
    private String getVersionName() {
        try { 
            PackageInfo pinfo = this.getPackageManager().getPackageInfo(getPackageName(), 0);
            return pinfo.versionName;
        } catch (NameNotFoundException e) {
            Log.e("EspiritoLivre:AboutActivity", e.getMessage());
            return null; 
        } 
    } 
}