private static int loadBuildNumber(Context context,PackageManager packageManager){
  try {
    ApplicationInfo appInfo=packageManager.getApplicationInfo(context.getPackageName(),PackageManager.GET_META_DATA);
    Bundle metaData=appInfo.metaData;
    if (metaData != null) {
      return metaData.getInt(BUNDLE_BUILD_NUMBER,0);
    }
  }
 catch (  PackageManager.NameNotFoundException e) {
    L.e("Exception thrown when accessing the application info:");
    e.printStackTrace();
  }
  return 0;
}

private static int loadBuildNumber ( Context context , PackageManager packageManager ) { try { ApplicationInfo appInfo = packageManager . getApplicationInfo ( context . getPackageName ( ) , PackageManager . GET_META_DATA ) ; Bundle metaData = appInfo . metaData ; if ( metaData != null ) { return metaData . getInt ( BUNDLE_BUILD_NUMBER , 0 ) ; } } catch ( PackageManager . NameNotFoundException e ) { L . e ( "Exception thrown when accessing the application info:" ) ; e . printStackTrace ( ) ; } return 0 ; }
helper method to load the build number from the androidmanifest .
