<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:id="@+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dp"
android:textColor="#FFFFFF" />
try {
int version = getPackageManager().getPackageInfo("com.example.main", 0).versionCode;
((TextView)findViewById(R.id.version)).setText(version+".0.0");
} catch (NameNotFoundException e) {
e.printStackTrace();
}