应用程序从unexception处理程序退出

应用程序从unexception处理程序退出

本文介绍了活动重新启动时,应用程序从unexception处理程序退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序使用一个全局的异常异常处理程序,以避免武力close.But活动是调用System.exit(0)之后开始.... ????

显示的logcat的是:

 十二月7号至18日:41:12.569:WARN /资源(8453):转换为字符串:{的TypedValue T = 0×12 / D =为0x0 A = 2 R = 0x7f07000a}
十二月7日至18日:41:14.648:信息/ ActivityManager(571):显示活动com.fss / .Loading:2643毫秒
十二月7日至18日:41:14.689:信息/的System.out(8453):>>>>>>>> SentRequestBE
十二月7日至18日:41:14.689:信息/的System.out(8453):>>>>>>>> StaticStore.dialog.getProgress()== 0 100
十二月7日至18日:41:15.399:信息/的System.out(8453):>>>>>>>> SentRequestBE
十二月7日至18日:41:15.429:信息/的System.out(8453):>>>>>>>> StaticStore.dialog.getProgress()== 20 100
十二月7日至18日:41:16.288:DEBUG / SmsProvider(611):插入URL =内容://短信/收件箱,匹配= 2
十二月7日至18日:41:16.510:DEBUG / dalvikvm(8453):GC释放5512对象/ 258536字节745ms
十二月7日至18日:41:16.640:信息/的System.out(8453):>>>>>>>> SentRequestBE
十二月7日至18日:41:16.662:信息/的System.out(8453):>>>>>>>> StaticStore.dialog.getProgress()== 40 100
十二月7日至18日:41:16.688:信息/的System.out(8453):>>>>>>>空
十二月7日至18日:41:16.739:DEBUG / AndroidRuntime(8453):关闭虚拟机
十二月7日至18日:41:16.739:WARN / dalvikvm(8453):主题ID = 3:线程退出与未捕获的异常(组= 0x4000fe70)
十二月7日至18日:41:16.799:信息/的System.out(8453):**********异常这里Ctached ** ******************
十二月7日至18日:41:16.919:错误/报告::( 8453):java.lang.RuntimeException的:无法启动接收器com.fss.SMSRecieve:显示java.lang.NullPointerException
十二月7日至18日:41:16.919:错误/报告::( 8453):---------堆栈跟踪---------
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.handleReceiver(ActivityThread.java:2417)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.access $ 2700型(ActivityThread.java:112)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1741)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.os.Handler.dispatchMessage(Handler.java:99)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.os.Looper.loop(Looper.java:123)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.main(ActivityThread.java:3948)
十二月7日至18日:41:16.919:错误/报告::( 8453):java.lang.reflect.Method.invokeNative(本机方法)
十二月7日至18日:41:16.919:错误/报告::( 8453):java.lang.reflect.Method.invoke(Method.java:521)
十二月7日至18日:41:16.919:错误/报告::( 8453):com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:782)
十二月7日至18日:41:16.919:错误/报告::( 8453):com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
十二月7日至18日:41:16.919:错误/报告::( 8453):dalvik.system.NativeStart.main(本机方法)
十二月7日至18日:41:16.919:错误/报告::( 8453):-------------------------------
十二月7日至18日:41:16.919:错误/报告::( 8453):--------- ---------原因
十二月7日至18日:41:16.919:错误/报告::( 8453):显示java.lang.NullPointerException
十二月7日至18日:41:16.919:错误/报告::( 8453):com.fss.SMSRecieve.onReceive(SMSRecieve.java:26)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.handleReceiver(ActivityThread.java:2408)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.access $ 2700型(ActivityThread.java:112)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1741)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.os.Handler.dispatchMessage(Handler.java:99)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.os.Looper.loop(Looper.java:123)
十二月7日至18日:41:16.919:错误/报告::( 8453):android.app.ActivityThread.main(ActivityThread.java:3948)
十二月7日至18日:41:16.919:错误/报告::( 8453):java.lang.reflect.Method.invokeNative(本机方法)
十二月7日至18日:41:16.919:错误/报告::( 8453):java.lang.reflect.Method.invoke(Method.java:521)
十二月7日至18日:41:16.919:错误/报告::( 8453):com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:782)
十二月7日至18日:41:16.919:错误/报告::( 8453):com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
十二月7日至18日:41:16.919:错误/报告::( 8453):dalvik.system.NativeStart.main(本机方法)
十二月7日至18日:41:16.939:信息/的System.out(8453):************* finally块enetered
十二月7日至18日:41:16.979:信息/ NotificationService(571):enqueueToast PKG = com.fss callback=android.app.ITransientNotification$Stub$Proxy@4381ced0时间= 1
十二月7日至18日:41:17.018:信息/ AndroidRuntime(8453):AndroidRuntime onExit调用exit(0)
十二月7日至18日:41:17.029:ERROR / JavaBinder(8453):未知粘结剂错误code。 0xfffffff7
十二月7日至18日:41:17.049:ERROR / JavaBinder(8453):未知粘结剂错误code。 0xfffffff7
十二月7日至18日:41:17.148:信息/ ActivityManager(571):过程com.fss(PID 8453)已死亡。
十二月7日至18日:41:17.188:信息/窗口管理器(571):WIN死亡:窗口{43721d70 com.fss / com.fss.DynamicCanvas暂停= FALSE}
十二月7日至18日:41:17.198:信息/窗口管理器(571):WIN死亡:窗口{43733cf8 com.fss / com.fss.ListSelection暂停= FALSE}
十二月7日至18日:41:17.198:信息/窗口管理器(571):WIN死亡:窗口{437ba200 com.fss / com.fss.DynamicCanvas暂停= FALSE}
十二月7日至18日:41:17.210:信息/窗口管理器(571):WIN死亡:窗口{43718e10 com.fss / com.fss.Loading暂停= FALSE}
十二月7日至18日:41:17.210:信息/窗口管理器(571):WIN死亡:窗口{43744eb8 com.fss / com.fss.Loading暂停= FALSE}
十二月7日至18日:41:17.509:信息/ ActivityManager(571):启动PROC com.fss的活动com.fss / .DynamicCanvas:PID = 8468的uid = 10019导报= {3003}
十二月7日至18日:41:17.958:信息/ JDWP(8468):收到的文件描述符20亚行
十二月7日至18日:41:18.189:警告/ System.err的(8468):不能调度DDM块46454154:没有处理程序中定义
十二月7日至18日:41:18.219:警告/ System.err的(8468):不能调度DDM块4d505251:无处理程序中定义
十二月7日至18日:41:19.710:信息/ ActivityManager(571):启动活动:意向{标志= 0x24000000处补偿= {com.fss / com.fss.SplashScreen}(有群众演员)}
十二月7日至18日:41:19.810:信息/的System.out(8468):动态画布......
7月18日12:41:20.010:信息/ System.out的(8468):GT;>>>大于5
十二月7日至18日:41:20.020:信息/的System.out(8468):>>>>> M-CONNECT登录
十二月7日至18日:41:20.030:信息/的System.out(8468):>>>>> APUM
十二月7日至18日:41:20.039:信息/的System.out(8468):>>>>>输入密码
十二月7日至18日:41:20.049:信息/的System.out(8468):>>>>> 4-6 NYY
7月18日12:41:20.079:信息/ System.out的(8468):GT;>>>大于1
十二月7日至18日:41:20.089:信息/的System.out(8468):温度>>>>> 1月4日至六日-N-Y-Y
十二月7日至18日:41:20.489:WARN / NotificationService(571):对象死亡试图隐藏通知android.app.ITransientNotification$Stub$Proxy@4381ced0封装com.fss
十二月7日至18日:41:20.499:WARN / ActivityManager(571):活动暂停超时HistoryRecord {437a8b80 {com.fss / com.fss.DynamicCanvas}}
十二月7日至18日:41:20.509:警告/ ActivityManager(571):setProcessForeground呼吁未知的PID:8453
十二月7日至18日:41:20.970:信息/ ActivityManager(571):moveTaskToBack:50
十二月7日至18日:41:21.699:WARN / InputManagerService(571):得到的RemoteException发送SETACTIVE(假)通知,为PID 8453 UID 10019
十二月7日至18日:41:22.049:WARN / ActivityManager(571):启动超时已过期,放弃唤醒锁!
十二月7日至18日:41:25.041:信息/的System.out(8468):>>>>>>>>>>>> OnCreateMethod
十二月7日至18日:41:25.359:信息/的System.out(8468):>>>>>>>>>>>> DBNAME /数据/数据​​/ COM。 FSS /数据库/ MPAY_444444
十二月7日至18日:41:25.369:ERROR /数据库(8468):失败1(表MiscDetails0029已经存在)上0x1acf30时preparing'创建表MiscDetails0029(ID整数主键不为空,table_row_one文本);。
十二月7日至18日:41:25.388:WARN / System.err的(8468):android.database.sqlite.SQLiteException:表MiscDetails0029已经存在:创建表MiscDetails0029(ID整数主键不为空,table_row_one文本);
十二月7日至18日:41:25.408:WARN / System.err的(8468):在android.database.sqlite.SQLiteDatabase.native_execSQL(本机方法)
十二月7日至18日:41:25.430:WARN / System.err的(8468):在android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1496)
十二月7日至18日:41:25.438:WARN / System.err的(8468):在com.fss.RmsStore $ CustomSQLiteOpenHelper.onCreate(RmsStore.java:240)
十二月7日至18日:41:25.448:WARN / System.err的(8468):在com.fss.RmsStore< INIT>(RmsStore.java:48)
十二月7日至18日:41:25.489:WARN / System.err的(8468):在com.fss.SplashScreen.startApp(SplashScreen.java:72)
十二月7日至18日:41:25.489:WARN / System.err的(8468):在com.fss.SplashScreen $ 1.运行(SplashScreen.java:53)
十二月7日至18日:41:25.608:信息/的System.out(8468)::::::::::::::::::: SataticStore.NO ON ACC6
十二月7日至18日:41:25.628:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.672:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.688:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.699:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.699:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.718:信息/的System.out(8468)::::::::::: acountNumbers0
十二月7日至18日:41:25.768:信息/ ActivityManager(571):启动活动:意向{补偿= {com.fss / com.fss.DynamicCanvas}}
十二月7日至18日:41:25.778:WARN / ActivityManager(571):startActivity非活动范围内调用;迫使Intent.FLAG_ACTIVITY_NEW_TASK为:意向{补偿= {com.fss / com.fss.DynamicCanvas}}
十二月7日至18日:41:26.969:信息/ ActivityManager(571):显示活动com.fss / .DynamicCanvas:9671毫秒
十二月7日至18日:41:27.670:WARN / NotificationService(571):停止指令玩家
十二月7日至18日:41:29.460:信息/ ActivityManager(571):停止服务:com.android.mms / .transaction.SmsReceiverService
十二月7日至18日:41:30.088:DEBUG / ActivityManager(571):checkComponentPermission(){调整PID,UID}到{542,1013}
十二月7日至18日:41:30.239:DEBUG / ActivityManager(571):checkComponentPermission(){调整PID,UID}到{542,1013}
十二月7日至18日:41:30.429:DEBUG / ActivityManager(571):checkComponentPermission(){调整PID,UID}到{542,1013}
十二月7日至18日:41:30.628:DEBUG / ActivityManager(571):checkComponentPermission(){调整PID,UID}到{542,1013}
十二月7日至18日:41:30.769:ERROR / MediaPlayerService(542):无法打开FD内容://设置/系统/ notification_sound
十二月7日至18日:41:30.799:ERROR / MediaPlayer的(571):无法创建媒体播放器
十二月7日至18日:41:30.839:WARN / NotificationService(571):错误加载声音的内容://设置/系统/ notification_sound
十二月7日至18日:41:30.839:WARN / NotificationService(571):java.io.IOException异常:的setDataSource失败:状态= 0x80000000的
十二月7日至18日:41:30.839:WARN / NotificationService(571):在android.media.MediaPlayer.setDataSource(本机方法)
十二月7日至18日:41:30.839:WARN / NotificationService(571):在android.media.MediaPlayer.setDataSource(MediaPlayer.java:610)
十二月7日至18日:41:30.839:WARN / NotificationService(571):在android.media.AsyncPlayer $ Thread.run(AsyncPlayer.java:76)
十二月7日至18日:41:32.818:DEBUG / dalvikvm(658):GC释放687对象/在537ms 28744字节
十二月7日至18日:41:37.668:DEBUG / dalvikvm(7930):GC释放1122对象/ 53896字节377ms
十二月7日至18日:41:42.769:DEBUG / dalvikvm(611):GC释放804对象/在476ms 39568字节
十二月7日至18日:41:48.278:DEBUG / dalvikvm(613):GC释放445对象/在495ms 21192字节
 

我重视的异常处理程序也......

 包com.fss;



进口java.lang.Thread.UncaughtExceptionHandler;

进口android.app.Activity;
进口android.app.AlertDialog;
进口android.content.Context;
进口android.content.Intent;
进口android.os.Looper;
进口android.util.Log;
进口android.view.KeyEvent;
进口android.view.SurfaceHolder;
进口android.widget.ProgressBar;
进口android.widget.Toast;

公共类TopExceptionHandler实现Thread.UncaughtExceptionHandler {

私人上下文的背景下;
//私人的UncaughtExceptionHandler的DefaultHandler;



    公共TopExceptionHandler(上下文的背景下){


StaticStore.defaultHandler =主题
.getDefaultUncaughtExceptionHandler();
this.context =背景;






    }






      公共无效uncaughtException(线程t,最终的Throwable E)

    {
         StaticStore.mfs = TRUE;
        尝试{
         新的Thread(){
            @覆盖
            公共无效的run(){
                活套prepare()。


            Toast.makeText(背景下,土司,Toast.LENGTH_LONG).show();


// context.startActivity(意向);
            //



            //System.exit(0);//If你要重新启动活动,并希望crash.s后杀
                Looper.loop();

            }
        }。开始();

        的System.out.println(************例外这里Ctached ************* *******);

        一个StackTraceElement [] ARR = e.getStackTrace();

        字符串报告= e.toString()+\ñ\ N的;

        报告+ =---------堆栈跟踪--------- \ñ\ N的;

        的for(int i = 0; I< arr.length;我++)

        {

        报告+ =+常用3 [I]的ToString()+\ N的;

        }

        报告+ =------------------------------- \ñ\ N的;




        //如果异常被抛出在后台线程里面

        // AsyncTask的,那么实际的异常,可以用的getCause发现



        报告+ =--------- ---------原因\ñ\ N的;




        Throwable的原因= e.getCause();

        如果(事业!= NULL){

        报告+ = cause.toString()+\ñ\ N的;

        ARR = cause.getStackTrace();

        的for(int i = 0; I< arr.length;我++)

        {

        报告+ =+常用3 [I]的ToString()+\ N的;

        }

        }


        Log.e(报告::,报告);



    }


        赶上(例外前){
              ex.printStackTrace();
          } 最后 {
              StaticStore.index = 0;
              的System.out.println(************* finally块enetered);
              StaticStore.dialog.dismiss();

//意图myIntent =新意图();
// myIntent.setClassName(com.fss,com.fss.DynamicCanvas);
// myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
// myIntent.putExtra(退出,真正的);
// context.startActivity(myIntent);
// System.runFinalizersOnExit(真正的);
 System.exit(0);
//System.out.println("after SYS退出);
// defaultHandler.uncaughtException(T,E);

          }
 //抛出新的RuntimeException(你只要抓住了我。);
    }


}
 

解决方案

略慢半拍的答案,但是......对我来说,这仅发生在少数的设备,例如三星的Nexus 7,为了避免这种恼人的重新启动我记得电流在静态变量和呼叫完成()活性 System.exit

在我的应用程序的所有活动

  //基类
类BaseActivity延伸活动{
  私有静态BaseActivity sCurrentActivity = NULL;

  @覆盖
  保护无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    sCurrentActivity =这一点;
  }

  @覆盖
  保护无效的OnStart(){
    super.onStart();
    sCurrentActivity =这一点;
  }

  @覆盖
  保护无效onResume(){
    super.onResume();
    sCurrentActivity =这一点;
  }

  @覆盖
  保护无效的onPause(){
    super.onPause();
    sCurrentActivity = NULL;
  }

  公共静态而System_Exit(INT退出code){
    如果(NULL!= sCurrentActivity){
      sCurrentActivity.finish();
      sCurrentActivity = NULL;
    }
    System.exit(退出code);
  }
}
 

In my application I use a global exception exception handler to avoid force close.But an activity is started after calling system.exit(0)....????

the logcat shown is:

07-18 12:41:12.569: WARN/Resources(8453): Converting to string: TypedValue{t=0x12/d=0x0 a=2 r=0x7f07000a}
07-18 12:41:14.648: INFO/ActivityManager(571): Displayed activity com.fss/.Loading: 2643 ms
07-18 12:41:14.689: INFO/System.out(8453): >>>>>>>>SentRequestBE
07-18 12:41:14.689: INFO/System.out(8453): >>>>>>>>StaticStore.dialog.getProgress()0==100
07-18 12:41:15.399: INFO/System.out(8453): >>>>>>>>SentRequestBE
07-18 12:41:15.429: INFO/System.out(8453): >>>>>>>>StaticStore.dialog.getProgress()20==100
07-18 12:41:16.288: DEBUG/SmsProvider(611): insert url=content://sms/inbox, match=2
07-18 12:41:16.510: DEBUG/dalvikvm(8453): GC freed 5512 objects / 258536 bytes in 745ms
07-18 12:41:16.640: INFO/System.out(8453): >>>>>>>>SentRequestBE
07-18 12:41:16.662: INFO/System.out(8453): >>>>>>>>StaticStore.dialog.getProgress()40==100
07-18 12:41:16.688: INFO/System.out(8453): >>>>>>>null
07-18 12:41:16.739: DEBUG/AndroidRuntime(8453): Shutting down VM
07-18 12:41:16.739: WARN/dalvikvm(8453): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
07-18 12:41:16.799: INFO/System.out(8453): ***************************EXception Ctached here********************
07-18 12:41:16.919: ERROR/Report ::(8453): java.lang.RuntimeException: Unable to start receiver com.fss.SMSRecieve: java.lang.NullPointerException
07-18 12:41:16.919: ERROR/Report ::(8453): --------- Stack trace ---------
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.handleReceiver(ActivityThread.java:2417)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.access$2700(ActivityThread.java:112)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1741)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.os.Handler.dispatchMessage(Handler.java:99)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.os.Looper.loop(Looper.java:123)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.main(ActivityThread.java:3948)
07-18 12:41:16.919: ERROR/Report ::(8453):     java.lang.reflect.Method.invokeNative(Native Method)
07-18 12:41:16.919: ERROR/Report ::(8453):     java.lang.reflect.Method.invoke(Method.java:521)
07-18 12:41:16.919: ERROR/Report ::(8453):     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
07-18 12:41:16.919: ERROR/Report ::(8453):     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-18 12:41:16.919: ERROR/Report ::(8453):     dalvik.system.NativeStart.main(Native Method)
07-18 12:41:16.919: ERROR/Report ::(8453): -------------------------------
07-18 12:41:16.919: ERROR/Report ::(8453): --------- Cause ---------
07-18 12:41:16.919: ERROR/Report ::(8453): java.lang.NullPointerException
07-18 12:41:16.919: ERROR/Report ::(8453):     com.fss.SMSRecieve.onReceive(SMSRecieve.java:26)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.handleReceiver(ActivityThread.java:2408)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.access$2700(ActivityThread.java:112)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1741)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.os.Handler.dispatchMessage(Handler.java:99)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.os.Looper.loop(Looper.java:123)
07-18 12:41:16.919: ERROR/Report ::(8453):     android.app.ActivityThread.main(ActivityThread.java:3948)
07-18 12:41:16.919: ERROR/Report ::(8453):     java.lang.reflect.Method.invokeNative(Native Method)
07-18 12:41:16.919: ERROR/Report ::(8453):     java.lang.reflect.Method.invoke(Method.java:521)
07-18 12:41:16.919: ERROR/Report ::(8453):     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
07-18 12:41:16.919: ERROR/Report ::(8453):     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
07-18 12:41:16.919: ERROR/Report ::(8453):     dalvik.system.NativeStart.main(Native Method)
07-18 12:41:16.939: INFO/System.out(8453): *************finally block enetered
07-18 12:41:16.979: INFO/NotificationService(571): enqueueToast pkg=com.fss callback=android.app.ITransientNotification$Stub$Proxy@4381ced0 duration=1
07-18 12:41:17.018: INFO/AndroidRuntime(8453): AndroidRuntime onExit calling exit(0)
07-18 12:41:17.029: ERROR/JavaBinder(8453): Unknown binder error code. 0xfffffff7
07-18 12:41:17.049: ERROR/JavaBinder(8453): Unknown binder error code. 0xfffffff7
07-18 12:41:17.148: INFO/ActivityManager(571): Process com.fss (pid 8453) has died.
07-18 12:41:17.188: INFO/WindowManager(571): WIN DEATH: Window{43721d70 com.fss/com.fss.DynamicCanvas paused=false}
07-18 12:41:17.198: INFO/WindowManager(571): WIN DEATH: Window{43733cf8 com.fss/com.fss.ListSelection paused=false}
07-18 12:41:17.198: INFO/WindowManager(571): WIN DEATH: Window{437ba200 com.fss/com.fss.DynamicCanvas paused=false}
07-18 12:41:17.210: INFO/WindowManager(571): WIN DEATH: Window{43718e10 com.fss/com.fss.Loading paused=false}
07-18 12:41:17.210: INFO/WindowManager(571): WIN DEATH: Window{43744eb8 com.fss/com.fss.Loading paused=false}
07-18 12:41:17.509: INFO/ActivityManager(571): Start proc com.fss for activity com.fss/.DynamicCanvas: pid=8468 uid=10019 gids={3003}
07-18 12:41:17.958: INFO/jdwp(8468): received file descriptor 20 from ADB
07-18 12:41:18.189: WARN/System.err(8468): Can't dispatch DDM chunk 46454154: no handler defined
07-18 12:41:18.219: WARN/System.err(8468): Can't dispatch DDM chunk 4d505251: no handler defined
07-18 12:41:19.710: INFO/ActivityManager(571): Starting activity: Intent { flags=0x24000000 comp={com.fss/com.fss.SplashScreen} (has extras) }
07-18 12:41:19.810: INFO/System.out(8468): Dynamic Canvas......
07-18 12:41:20.010: INFO/System.out(8468): >>>>>5
07-18 12:41:20.020: INFO/System.out(8468): >>>>> M-CONNECT  Login
07-18 12:41:20.030: INFO/System.out(8468): >>>>>APUM
07-18 12:41:20.039: INFO/System.out(8468): >>>>>Enter password
07-18 12:41:20.049: INFO/System.out(8468): >>>>>4-6-N-Y-Y
07-18 12:41:20.079: INFO/System.out(8468): >>>>>1
07-18 12:41:20.089: INFO/System.out(8468): temp >>>>> 1 4-6-N-Y-Y
07-18 12:41:20.489: WARN/NotificationService(571): Object died trying to hide notification android.app.ITransientNotification$Stub$Proxy@4381ced0 in package com.fss
07-18 12:41:20.499: WARN/ActivityManager(571): Activity pause timeout for HistoryRecord{437a8b80 {com.fss/com.fss.DynamicCanvas}}
07-18 12:41:20.509: WARN/ActivityManager(571): setProcessForeground called on unknown pid: 8453
07-18 12:41:20.970: INFO/ActivityManager(571): moveTaskToBack: 50
07-18 12:41:21.699: WARN/InputManagerService(571): Got RemoteException sending setActive(false) notification to pid 8453 uid 10019
07-18 12:41:22.049: WARN/ActivityManager(571): Launch timeout has expired, giving up wake lock!
07-18 12:41:25.041: INFO/System.out(8468): >>>>>>>>>>>>OnCreateMethod
07-18 12:41:25.359: INFO/System.out(8468): >>>>>>>>>>>>DBNAME/data/data/com.fss/databases/MPAY_444444
07-18 12:41:25.369: ERROR/Database(8468): Failure 1 (table MiscDetails0029 already exists) on 0x1acf30 when preparing 'create table MiscDetails0029 (id integer primary key not null,table_row_one text);'.
07-18 12:41:25.388: WARN/System.err(8468): android.database.sqlite.SQLiteException: table MiscDetails0029 already exists: create table MiscDetails0029 (id integer primary key not null,table_row_one text);
07-18 12:41:25.408: WARN/System.err(8468):     at android.database.sqlite.SQLiteDatabase.native_execSQL(Native Method)
07-18 12:41:25.430: WARN/System.err(8468):     at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1496)
07-18 12:41:25.438: WARN/System.err(8468):     at com.fss.RmsStore$CustomSQLiteOpenHelper.onCreate(RmsStore.java:240)
07-18 12:41:25.448: WARN/System.err(8468):     at com.fss.RmsStore.<init>(RmsStore.java:48)
07-18 12:41:25.489: WARN/System.err(8468):     at com.fss.SplashScreen.startApp(SplashScreen.java:72)
07-18 12:41:25.489: WARN/System.err(8468):     at com.fss.SplashScreen$1.run(SplashScreen.java:53)
07-18 12:41:25.608: INFO/System.out(8468): ::::::::::::::::::SataticStore.NO ON ACC6
07-18 12:41:25.628: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.672: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.688: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.699: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.699: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.718: INFO/System.out(8468): ::::::::::acountNumbers0
07-18 12:41:25.768: INFO/ActivityManager(571): Starting activity: Intent { comp={com.fss/com.fss.DynamicCanvas} }
07-18 12:41:25.778: WARN/ActivityManager(571): startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { comp={com.fss/com.fss.DynamicCanvas} }
07-18 12:41:26.969: INFO/ActivityManager(571): Displayed activity com.fss/.DynamicCanvas: 9671 ms
07-18 12:41:27.670: WARN/NotificationService(571): STOP command without a player
07-18 12:41:29.460: INFO/ActivityManager(571): Stopping service: com.android.mms/.transaction.SmsReceiverService
07-18 12:41:30.088: DEBUG/ActivityManager(571): checkComponentPermission() adjusting {pid,uid} to {542,1013}
07-18 12:41:30.239: DEBUG/ActivityManager(571): checkComponentPermission() adjusting {pid,uid} to {542,1013}
07-18 12:41:30.429: DEBUG/ActivityManager(571): checkComponentPermission() adjusting {pid,uid} to {542,1013}
07-18 12:41:30.628: DEBUG/ActivityManager(571): checkComponentPermission() adjusting {pid,uid} to {542,1013}
07-18 12:41:30.769: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound
07-18 12:41:30.799: ERROR/MediaPlayer(571): Unable to to create media player
07-18 12:41:30.839: WARN/NotificationService(571): error loading sound for content://settings/system/notification_sound
07-18 12:41:30.839: WARN/NotificationService(571): java.io.IOException: setDataSource failed.: status=0x80000000
07-18 12:41:30.839: WARN/NotificationService(571):     at android.media.MediaPlayer.setDataSource(Native Method)
07-18 12:41:30.839: WARN/NotificationService(571):     at android.media.MediaPlayer.setDataSource(MediaPlayer.java:610)
07-18 12:41:30.839: WARN/NotificationService(571):     at android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76)
07-18 12:41:32.818: DEBUG/dalvikvm(658): GC freed 687 objects / 28744 bytes in 537ms
07-18 12:41:37.668: DEBUG/dalvikvm(7930): GC freed 1122 objects / 53896 bytes in 377ms
07-18 12:41:42.769: DEBUG/dalvikvm(611): GC freed 804 objects / 39568 bytes in 476ms
07-18 12:41:48.278: DEBUG/dalvikvm(613): GC freed 445 objects / 21192 bytes in 495ms

i attached the exception handler also....

package com.fss;



import java.lang.Thread.UncaughtExceptionHandler;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.widget.ProgressBar;
import android.widget.Toast;

public class TopExceptionHandler implements Thread.UncaughtExceptionHandler   {

private Context context;
//private UncaughtExceptionHandler defaultHandler;



    public TopExceptionHandler(Context context) {


StaticStore.defaultHandler = Thread
.getDefaultUncaughtExceptionHandler();
this.context=context;






    }






      public void uncaughtException(Thread t,final Throwable e)

    {
         StaticStore.mfs=true;
        try{
         new Thread() {
            @Override
            public void run() {
                Looper.prepare();


            Toast.makeText(context, "TOAST", Toast.LENGTH_LONG).show();


//              context.startActivity(intent);
            //



            //System.exit(0);//If you want to restart activity and want to kill after crash.s
                Looper.loop();

            }
        }.start();

        System.out.println("***************************EXception Ctached here********************");

        StackTraceElement[] arr = e.getStackTrace();

        String report = e.toString()+"\n\n";

        report += "--------- Stack trace ---------\n\n";

        for (int i=0; i<arr.length; i++)

        {

        report += "    "+arr[i].toString()+"\n";

        }

        report += "-------------------------------\n\n";




        // If the exception was thrown in a background thread inside

        // AsyncTask, then the actual exception can be found with getCause



        report += "--------- Cause ---------\n\n";




        Throwable cause = e.getCause();

        if(cause != null) {

        report += cause.toString() + "\n\n";

        arr = cause.getStackTrace();

        for (int i=0; i<arr.length; i++)

        {

        report += "    "+arr[i].toString()+"\n";

        }

        }


        Log.e("Report ::",report);



    }


        catch (Exception ex) {
              ex.printStackTrace();
          } finally {
              StaticStore.index=0;
              System.out.println("*************finally block enetered");
              StaticStore.dialog.dismiss();

//            Intent myIntent = new Intent();
//            myIntent.setClassName("com.fss","com.fss.DynamicCanvas");
//              myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
//              myIntent.putExtra("EXIT", true);
//              context.startActivity(myIntent);
//            System.runFinalizersOnExit(true);
 System.exit(0);
//System.out.println("after sys exit");
//  defaultHandler.uncaughtException(t, e);

          }
 //   throw new RuntimeException("You just caught me..");
    }


}
解决方案

Slightly belated answer, but... In my case this occurs only on few devices, for example on Samsung Nexus 7. To avoid this annoying restarts i remember current activity in static variable and call finish() before System.exit:

// base class for all activities in my application
class BaseActivity extends Activity {
  private static BaseActivity sCurrentActivity = null;

  @Override
  protected void onCreate( Bundle savedInstanceState ) {
    super.onCreate( savedInstanceState );
    sCurrentActivity = this;
  }

  @Override
  protected void onStart() {
    super.onStart();
    sCurrentActivity = this;
  }

  @Override
  protected void onResume() {
    super.onResume();
    sCurrentActivity = this;
  }

  @Override
  protected void onPause() {
    super.onPause();
    sCurrentActivity = null;
  }

  public static System_exit( int exitCode ) {
    if ( null != sCurrentActivity ) {
      sCurrentActivity.finish();
      sCurrentActivity = null;
    }
    System.exit( exitCode );
  }
}

这篇关于活动重新启动时,应用程序从unexception处理程序退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:53