Output android versionname as string

This question already has an answer here:

  • How to get the build/version number of your Android application? 23 answers

  • android:text="?android:attr/versionName"

    Pleasae do not write markup/code etc you do not understand in first place. This is not going to do any magic just because you wrote it or deeply hope it to work even especially it makes no sense at all.

    Data from Manifest can be obtained by using of PackageManager

    PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    

    PackageInfo structure holds both versionName and versionCode - See docs here.

    链接地址: http://www.djcxy.com/p/90752.html

    上一篇: 检查应用程序是否在第一次运行

    下一篇: 输出android versionname作为字符串