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.moreteapots; 18 19 import javax.microedition.khronos.opengles.GL10; 20 21 import com.sample.helper.NDKHelper; 22 23 import android.app.Application; 24 import android.content.Context; 25 import android.content.pm.ApplicationInfo; 26 import android.content.pm.PackageManager; 27 import android.content.pm.PackageManager.NameNotFoundException; 28 import android.graphics.Bitmap; 29 import android.graphics.BitmapFactory; 30 import android.graphics.Matrix; 31 import android.opengl.GLUtils; 32 import android.util.Log; 33 import android.widget.Toast; 34 35 public class MoreTeapotsApplication extends Application { 36 private static Context context; 37 public void onCreate(){ 38 context=getApplicationContext(); 39 NDKHelper.setContext(context); 40 Log.w("native-activity", "onCreate"); 41 42 final PackageManager pm = getApplicationContext().getPackageManager(); 43 ApplicationInfo ai; 44 try { 45 ai = pm.getApplicationInfo( this.getPackageName(), 0); 46 } catch (final NameNotFoundException e) { 47 ai = null; 48 } 49 final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)"); 50 Toast.makeText(this, applicationName, Toast.LENGTH_SHORT).show(); 51 } 52 53 } 54