Home | History | Annotate | Download | only in teapot
      1 /*
      2  * Copyright 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.sample.teapot;
     18 
     19 import javax.microedition.khronos.opengles.GL10;
     20 
     21 import android.app.Application;
     22 import android.content.Context;
     23 import android.content.pm.ApplicationInfo;
     24 import android.content.pm.PackageManager;
     25 import android.content.pm.PackageManager.NameNotFoundException;
     26 import android.graphics.Bitmap;
     27 import android.graphics.BitmapFactory;
     28 import android.graphics.Matrix;
     29 import android.opengl.GLUtils;
     30 import android.util.Log;
     31 import android.widget.Toast;
     32 
     33 public class TeapotApplication extends Application {
     34     public void onCreate(){
     35         Log.w("native-activity", "onCreate");
     36 
     37         final PackageManager pm = getApplicationContext().getPackageManager();
     38         ApplicationInfo ai;
     39         try {
     40             ai = pm.getApplicationInfo( this.getPackageName(), 0);
     41         } catch (final NameNotFoundException e) {
     42             ai = null;
     43         }
     44         final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)");
     45         Toast.makeText(this, applicationName, Toast.LENGTH_SHORT).show();
     46     }
     47 }
     48