Tools - Get Version Code/Name

//Create variable versionName and versionCode

String versionName = "null";
int versionCode = -1;
try {
android.content.pm.PackageInfo packageInfo = MainActivity.this.getPackageManager().getPackageInfo(getPackageName(), 0);
versionName = packageInfo.versionName;
versionCode = packageInfo.versionCode;
} catch (android.content.pm.PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
//textview set text
TextView textViewVersionInfo = (TextView) findViewById(R.id.textview1);
textViewVersionInfo.setText(String.format("Version Name: %s Version Code:%d", versionName, versionCode));

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to enable download in webview in Sketchware apps?

Create Stopwatch App in Android using Sketchware

A Flash Light App in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification

Codes for modifying Action Bar in Sketchware

Code for implementing Notifications in Sketchware