Setting build & version number

This commit is contained in:
Kevin Meyer 2014-08-19 21:24:22 +02:00
parent b6b7675eb5
commit a71a0a7bd8
4 changed files with 10 additions and 4 deletions

View File

@ -19,8 +19,8 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
versionCode 9
versionName "1.6"
}
sourceSets {

View File

@ -102,7 +102,6 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:text="@string/version"
android:textSize="12sp" />
<TextView

View File

@ -23,5 +23,4 @@
<string name="txtGlobalToken"><b><u>API global token :</u></b></string>
<string name="txtAPIUsername"><b><u>Your User ID:</u></b></string>
<string name="txtAPIToken"><b><u>Your Token:</u></b></string>
<string name="version">1.5.3.2</string>
</resources>

View File

@ -9,6 +9,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Settings extends Activity {
Button btnDone;
@ -16,6 +17,7 @@ public class Settings extends Activity {
EditText editAPIUsername;
EditText editAPIToken;
EditText editGlobalToken;
TextView textViewVersion;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -43,5 +45,11 @@ public class Settings extends Activity {
finish();
}
});
try {
textViewVersion = (TextView) findViewById(R.id.version);
textViewVersion.setText(getApplicationContext().getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0).versionName);
} catch (Exception e) {
//
}
}
}