1 /*
2  * Copyright © 2012 Linaro Limited
3  *
4  * This file is part of the glmark2 OpenGL (ES) 2.0 benchmark.
5  *
6  * glmark2 is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * glmark2 is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * glmark2.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Authors:
20  *  Alexandros Frantzis
21  */
22 package org.linaro.glmark2;
23 
24 import android.app.Activity;
25 import android.content.pm.PackageInfo;
26 import android.os.Bundle;
27 import android.view.Window;
28 import android.widget.TextView;
29 
30 public class AboutActivity extends Activity {
31     @Override
onCreate(Bundle savedInstanceState)32     public void onCreate(Bundle savedInstanceState) {
33         super.onCreate(savedInstanceState);
34         requestWindowFeature(Window.FEATURE_NO_TITLE);
35         setContentView(R.layout.activity_about);
36 
37         /* Get the application version */
38         String versionName = "?";
39 
40         try {
41             PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
42             versionName = info.versionName;
43         }
44         catch (Exception e) {
45         }
46 
47         /* Display the application version */
48         TextView tv = (TextView) findViewById(R.id.name_version);
49         String formatString = getString(R.string.about_name_version_format);
50         tv.setText(String.format(formatString, versionName));
51     }
52 }
53