Application.java 1.08 KB
package com.sunvote.xpadapp;


import com.sunvote.udptransfer.UDPModule;
import com.sunvote.util.LogUtil;

/**
 * Created by Elvis on 2017/11/30 10:52
 * Email:Eluis@psunsky.com
 * 版权所有:长沙中天电子设计开发有限公司
 * Description: 人大通用版 XPadAppRD
 */
public class Application extends android.app.Application {

    @Override
    public void onCreate() {
        super.onCreate();
        final Thread.UncaughtExceptionHandler uncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable ex) {
                LogUtil.e(UDPModule.TAG, "carsh(thread id:" + thread.getId() + ",thread name:" + thread.getName() + ")");
                LogUtil.e(UDPModule.TAG, ex);
                if (uncaughtExceptionHandler != null) {
                    uncaughtExceptionHandler.uncaughtException(thread, ex);
                }
                System.exit(0);
            }
        });
    }
}