CopyPastor

Detecting plagiarism made easy.

Score: 0.8023090362548828; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-08-19
by Jinal Awaiya

Original Post

Original - Posted on 2011-07-06
by plus-



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Try this,
try { PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); String version = pInfo.versionName; int verCode = pInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); }



Use:
try { PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); String version = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); }
And you can get the version code by using this
int verCode = pInfo.versionCode;

        
Present in both answers; Present only in the new answer; Present only in the old answer;