2

How can I get the build number of my Android app and setText to a textview?

For example, "Build # 91".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
athulya k
  • 145
  • 2
  • 10

1 Answers1

7

Simple and short way: implement into your activity

String versionName = getApplicationContext().getPackageManager()
.getPackageInfo(getApplicationContext().getPackageName(), 0).versionName;
TextView tv=(TextView)findViewById(R.id.tv); 
tv.setText(versionName);
M D
  • 47,665
  • 9
  • 93
  • 114