Android Open Source - SampleAlertDialog Main Application






From Project

Back to project page SampleAlertDialog.

License

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.

Java Source Code

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 "";
        }
    }

}




Java Source Code List

com.neetpiq.android.samplealertdialog.MainActivity.java
com.neetpiq.android.samplealertdialog.MainApplication.java
com.neetpiq.android.samplealertdialog.NothingSelectedSpinnerAdapter.java
com.neetpiq.android.samplealertdialog.OtherActivity.java
com.neetpiq.android.samplealertdialog.data.DatabaseHelper.java
com.neetpiq.android.samplealertdialog.data.DatabaseManager.java
com.neetpiq.android.samplealertdialog.model.Speaker.java
com.neetpiq.android.samplealertdialog.model.TimeSlot.java
com.neetpiq.android.samplealertdialog.model.Topic.java
com.neetpiq.android.samplealertdialog.util.AlertUtil.java
com.neetpiq.android.samplealertdialog.util.ToastUtils.java