Back to project page SampleAlertDialog.
The source code is released under:
MIT License
If you think the Android project SampleAlertDialog listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.neetpiq.android.samplealertdialog; // w ww .ja va 2 s .co m import android.app.Application; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import com.neetpiq.android.samplealertdialog.data.DatabaseManager; import com.neetpiq.android.samplealertdialog.util.ToastUtils; public class MainApplication extends Application { protected static final String TAG = "MainApplication"; public static String versionName; @Override public void onCreate() { versionName = getVersionName(); // init database manager DatabaseManager.initInstance(getApplicationContext()); super.onCreate(); } @Override public void onLowMemory() { ToastUtils.showToast(getApplicationContext(), "onLowMemory"); super.onLowMemory(); } private String getVersionName() { PackageManager pm = getPackageManager(); try { PackageInfo pi = pm.getPackageInfo(getPackageName(), 0); return pi.versionName == null ? "" : pi.versionName; } catch (NameNotFoundException e) { return ""; } } }