/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/AboutScreen.java
ViewVC logotype

Contents of /android/TrainInfo/src/dk/thoerup/traininfo/AboutScreen.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1638 - (show annotations) (download)
Sun Nov 27 19:44:28 2011 UTC (12 years, 5 months ago) by torben
File size: 805 byte(s)
Add basic about screen (and add /bin/ to svn:ignore)
1 package dk.thoerup.traininfo;
2
3 import android.app.Activity;
4 import android.content.pm.PackageInfo;
5 import android.content.pm.PackageManager;
6 import android.os.Bundle;
7 import android.widget.TextView;
8
9
10 public class AboutScreen extends Activity{
11
12 @Override
13 public void onCreate(Bundle savedInstanceState) {
14 super.onCreate(savedInstanceState);
15 setContentView(R.layout.about);
16
17
18
19 TextView version = (TextView) findViewById(R.id.app_version);
20 version.setText( "Version: " + getVersion() );
21
22 }
23
24 public String getVersion() {
25 String version = "";
26 PackageManager pm = this.getPackageManager();
27 try {
28 PackageInfo pi = pm.getPackageInfo(getPackageName(), 0);
29 version = pi.versionName;
30 } catch(PackageManager.NameNotFoundException e) {/* do nothing*/}
31
32 return version;
33 }
34 }

  ViewVC Help
Powered by ViewVC 1.1.20