0

我正在运行一个 web 服务 android 并正确插入,但是当应用程序意外终止时结束。

有谁知道为什么?

这是代码...

 protected Void doInBackground(final Void... unused) {


   Opdblevantamiento info = new Opdblevantamiento(SyndatlevwsAsyncTask.this);
    info.Abrir();
    Cursor c = info.recibirLevantamiento();
    //-----------------------------------
    int fila;
    String cc02="",cc03="",cc04="",cc05="";
    String cc06="",cc07="",cc08="", cc09="",cc10="";
    String cc11="",cc12="",cc13="", cc14="";

    //-----------------------------------

    int c01=c.getColumnIndex(ID_FILA);
    int c02=c.getColumnIndex(NCTA);
    int c03=c.getColumnIndex(NOMBREPROP);
    int c04=c.getColumnIndex(COLONIA);
    int c05=c.getColumnIndex(CALLE);
    int c06=c.getColumnIndex(DAT_A);
    int c07=c.getColumnIndex(DAT_B);
    int c08=c.getColumnIndex(DAT_C);
    int c09=c.getColumnIndex(DAT_D);
    int c10=c.getColumnIndex(DAT_E);
    int c11=c.getColumnIndex(INFRAESTRUCTURA);
    int c12=c.getColumnIndex(NOMBREPRED);
    int c13=c.getColumnIndex(FECHA);
    int c14=c.getColumnIndex(HORA);     


    //String resultado2="Cuentas No Generadas: \n";
    //String resultado = "Cuentas Generadas con Éxito: \n";
    String datWs=null;

    for(c.moveToFirst();!c.isAfterLast();c.moveToNext())
    {
        fila=Integer.parseInt(c.getString(c01));
        cc02=c.getString(c02).toString();
        cc03=c.getString(c03).toString();
        cc04=c.getString(c04).toString();
        cc05=c.getString(c05).toString();
        cc06=c.getString(c06).toString();
        cc07=c.getString(c07).toString();
        cc08=c.getString(c08).toString();
        cc09=c.getString(c09).toString();
        cc10=c.getString(c10).toString();
        cc11=c.getString(c11).toString();
        cc12=c.getString(c12).toString();
        cc13=c.getString(c13).toString();
        cc14=c.getString(c14).toString();

        datWs=consumiendoWsLevantamiento(cc02,cc03,cc04,cc05,cc06,cc07,cc08,cc09,cc10,cc11,cc12,cc13,cc14);
         Log.i("wsInicio", datWs);
        if(datWs != null)
        {
            long datUpd=info.updatelev(fila);
            if(datUpd>0)
            {
                //Toast.makeText(this, "Registro registrado exitosamente: " + cc02 , Toast.LENGTH_SHORT).show();
                //resultado=resultado+"::"+cc02+"::  \n";
                System.out.println("Folio Insertado: [" + datWs + "]");
                publishProgress("Cuenta Registrada: " + cc02);

                //this.dialog.setMessage("Folio Insertado: [" + datWs + "]");
                //onProgressUpdate(Integer.parseInt(datWs)); // Invokes onProgressUpdate()
                // this.dialog.show();
            }                   

        }
        else
        {
            System.out.println("Error ws: " + datWs);
            publishProgress("Error de conexión no se pudo registrar la cuenta: " + cc02);
            LevantamientoTask.this.cancel(true);
        }
            //resultado2=resultado2+"||"+cc02+"||"+" ."+datWs + ". \n";

    }

    info.cerrar();


    //resultado = resultado + resultado2;

    //txtdat.setText(String.valueOf(resultado));
    //txtdat2.setText(String.valueOf(resultado2));

   //String auth=doLogin(t_id,password);
   //System.out.println(auth);

   return null; // don't interact with the ui!

}

和错误控制台.....

04-04 18:11:14.828: D/dalvikvm(32008): GC_CONCURRENT freed 316K, 6% free 7676K/8135K, paused 14ms+6ms
04-04 18:11:26.977: D/dalvikvm(32008): GC_CONCURRENT freed 434K, 7% free 7696K/8263K, paused 3ms+5ms
04-04 18:11:38.048: I/dalvikvm(32008): Jit: resizing JitTable from 512 to 1024
04-04 18:11:44.318: D/dalvikvm(32008): GC_CONCURRENT freed 437K, 7% free 7706K/8263K, paused 10ms+22ms
04-04 18:11:55.588: D/dalvikvm(32008): GC_CONCURRENT freed 418K, 7% free 7694K/8263K, paused 4ms+4ms
04-04 18:11:59.208: D/dalvikvm(32008): GREF has increased to 201
04-04 18:11:59.718: D/dalvikvm(32008): GC_CONCURRENT freed 346K, 7% free 7799K/8327K, paused 13ms+12ms
04-04 18:12:20.328: D/dalvikvm(32008): GC_CONCURRENT freed 502K, 8% free 7738K/8391K, paused 12ms+35ms
04-04 18:12:26.318: I/dalvikvm(32008): Jit: resizing JitTable from 1024 to 2048
04-04 18:12:32.997: D/dalvikvm(32008): GC_CONCURRENT freed 400K, 8% free 7733K/8391K, paused 12ms+4ms
04-04 18:12:43.168: D/dalvikvm(32008): GC_CONCURRENT freed 399K, 8% free 7734K/8391K, paused 10ms+4ms
04-04 18:12:53.278: D/dalvikvm(32008): GC_CONCURRENT freed 400K, 8% free 7739K/8391K, paused 4ms+5ms
04-04 18:13:05.487: D/dalvikvm(32008): GC_CONCURRENT freed 408K, 8% free 7742K/8391K, paused 12ms+5ms
04-04 18:13:15.358: D/dalvikvm(32008): GC_CONCURRENT freed 337K, 7% free 7808K/8391K, paused 9ms+11ms
04-04 18:13:18.118: I/System.out(32008): NuevoLevantamiento{c1=55555; c2=kkkkk; c3=kkkk; c4=kkkkk; c5=|01|09|07|2009|10|; c6=; c7=; c8=; c9=; c10=|true|false|true|false|true|; c11=hhhh; c12=04/04/2013; c13=18:11:59S; }
04-04 18:13:18.618: I/levantemiento(32008): 35
04-04 18:13:18.618: I/System.out(32008): response35
04-04 18:13:18.618: I/System.out(32008): 35
04-04 18:13:18.618: I/wsInicio(32008): 35
04-04 18:13:18.651: I/System.out(32008): Folio Insertado: [35]
04-04 18:13:18.670: I/System.out(32008): NuevoLevantamiento{c1=5555; c2=rrrrr; c3=xc; c4=xa; c5=|02|00|00|2007|480|; c6=; c7=; c8=; c9=; c10=|true|false|true|false|true|; c11=yyy; c12=04/04/2013; c13=18:13:08S; }
04-04 18:13:18.877: I/levantemiento(32008): 36
04-04 18:13:18.877: I/System.out(32008): response36
04-04 18:13:18.877: I/System.out(32008): 36
04-04 18:13:18.877: I/wsInicio(32008): 36
04-04 18:13:18.908: I/System.out(32008): Folio Insertado: [36]
04-04 18:13:18.928: D/AndroidRuntime(32008): Shutting down VM
04-04 18:13:18.928: W/dalvikvm(32008): threadid=1: thread exiting with uncaught exception (group=0x40014760)
04-04 18:13:18.928: E/AndroidRuntime(32008): FATAL EXCEPTION: main
04-04 18:13:18.928: E/AndroidRuntime(32008): java.lang.NullPointerException
04-04 18:13:18.928: E/AndroidRuntime(32008):    at jmatias.levantamiento.SyndatlevwsAsyncTask$LevantamientoTask.onPostExecute(SyndatlevwsAsyncTask.java:280)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at jmatias.levantamiento.SyndatlevwsAsyncTask$LevantamientoTask.onPostExecute(SyndatlevwsAsyncTask.java:1)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.os.AsyncTask.finish(AsyncTask.java:590)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.os.AsyncTask.access$600(AsyncTask.java:149)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:603)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.os.Looper.loop(Looper.java:126)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at android.app.ActivityThread.main(ActivityThread.java:3997)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at java.lang.reflect.Method.invokeNative(Native Method)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at java.lang.reflect.Method.invoke(Method.java:491)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
04-04 18:13:18.928: E/AndroidRuntime(32008):    at dalvik.system.NativeStart.main(Native Method)
04-04 18:18:18.988: I/Process(32008): Sending signal. PID: 32008 SIG: 9
4

1 回答 1

1

错误出现在您未发布代码的 AsyncTask 的 onPostExecute() 部分中。如果您查看堆栈跟踪,它会告诉您错误在该方法的第 280 行。您正在对该行中为 NULL 的内容调用方法。

于 2013-04-04T18:32:09.963 回答