show ver in toolbar

This commit is contained in:
Milos Kozak 2016-07-03 19:21:41 +02:00
parent 15d64ce4eb
commit f8301360dc
2 changed files with 9 additions and 2 deletions

View file

@ -23,8 +23,8 @@ android {
applicationId "info.nightscout.androidaps"
minSdkVersion 21
targetSdkVersion 23
versionCode 1003
versionName "1.0.03"
versionCode 1004
versionName "1.0.04"
}
buildTypes {
release {

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
@ -57,6 +58,12 @@ public class MainActivity extends AppCompatActivity {
if (Config.logFunctionCalls)
log.debug("onCreate");
// show version in toolbar
try {
setTitle(getString(R.string.app_name) + " v" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);