AsyncTask类的运行时错误

时间:2014-01-04 10:08:12

标签: android android-asynctask runtime-error

我对android很新,这是我第一次使用AsyncTask。我无法通过调试找到错误,因为调试器仅在onPreExecute方法中输入而不在doInBackground方法中输入。所以我认为错误是两种方法之一,但我无法理解2.

以下是此课程的代码:

package com.PacchettoPrincipale.app;

import [...]

public class LoadFermate extends AsyncTask<Void, Void, ArrayList<HashMap<String, String>>> {

    private Context context;

    public LoadFermate(Context context){
        this.context = context;
    }

    private ProgressDialog pDialog;

    private JSONArray mComments = null;
    private ArrayList<HashMap<String, String>> mCommentList;

    //testing on Emulator:
    private static final String DOWNLOAD_FERMATE_URL = "http://10.0.2.2/PrimaAppAndroid/fermate.php";

    //JSON IDS:
    private static final String TAG_COD = "CodFermata";
    private static final String TAG_POSTS = "posts";
    private static final String TAG_NOME = "Nome";

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(context);
        pDialog.setMessage("Download fermate...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(true);
        pDialog.show();
    }

    @Override
    protected ArrayList<HashMap<String, String>> doInBackground(Void... voids) {
        updateJSONData();

        return mCommentList;
    }

    @Override
    protected void onPostExecute(ArrayList<HashMap<String, String>> hashMaps) {
        super.onPostExecute(hashMaps);

        pDialog.dismiss();

        for(int x = 0; x < hashMaps.size(); x++){
            String testo = hashMaps.get(x).toString();
            Toast.makeText(this.context , testo, Toast.LENGTH_SHORT);
        }
    }

    private void updateJSONData() {

        mCommentList = new ArrayList<HashMap<String, String>>();

        JSONParser jParser = new JSONParser();
        JSONObject json = jParser.getJSONFromUrl(DOWNLOAD_FERMATE_URL);

        try {

            mComments = json.getJSONArray(TAG_POSTS);

            for (int i = 0; i < mComments.length(); i++) {
                JSONObject c = mComments.getJSONObject(i);

                int CodFermata = c.getInt(TAG_COD);
                String Nome = c.getString(TAG_NOME);


                HashMap<String, String> map = new HashMap<String, String>();

                map.put(TAG_COD, String.valueOf(CodFermata));
                map.put(TAG_NOME, Nome);

                mCommentList.add(map);

            }

        } catch (JSONException e) {
            e.printStackTrace();
        }


    }
}

我从传递上下文的其他类中调用它:new LoadFermate(getApplicationContext()).execute();

这是Register类的一段代码,我称之为AsyncTask。我把它放在onCreate中只是因为我在最终实现之前进行了测试。

public class Register extends Activity implements OnClickListener{

    private EditText user, pass, codDoc;
    private Button  mRegister;

    [...]

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        [...]
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub

        //new CreateUser().execute();
        new LoadFermate(Register.this).execute();  // HERE
    }

    class CreateUser extends AsyncTask<String, String, String> { [...]}


}

和logCat:

        01-04 05:37:48.883      396-616/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:48.883      396-616/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:48.883      396-616/system_process I/PackageManager﹕ Scheme: "mms"
        01-04 05:37:48.883      396-616/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:48.933      396-616/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:48.933      396-616/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:48.933      396-616/system_process I/PackageManager﹕ Scheme: "mmsto"
        01-04 05:37:48.933      396-616/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:48.993      544-544/com.android.phone D/dalvikvm﹕ GC_FOR_ALLOC freed 368K, 16% free 3403K/4004K, paused 26ms, total 27ms
        01-04 05:37:49.013      396-407/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.013      396-407/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.013      396-407/system_process I/PackageManager﹕ Scheme: "sms"
        01-04 05:37:49.013      396-407/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.043    1521-1521/? D/AndroidRuntime﹕ Shutting down VM
        01-04 05:37:49.053    1521-1527/? D/jdwp﹕ Got wake-up signal, bailing out of select
        01-04 05:37:49.063    1521-1527/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
        01-04 05:37:49.143      396-442/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.143      396-442/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.143      396-442/system_process I/PackageManager﹕ Scheme: "smsto"
        01-04 05:37:49.143      396-442/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.193      396-616/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.193      396-616/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.203      396-616/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.203      396-616/system_process I/PackageManager﹕ Scheme: "mms"
        01-04 05:37:49.253      396-407/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.253      396-407/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.253      396-407/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.263      396-407/system_process I/PackageManager﹕ Scheme: "mmsto"
        01-04 05:37:49.383      396-408/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.383      396-408/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.383      396-408/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.393      396-408/system_process I/PackageManager﹕ Scheme: "sms"
        01-04 05:37:49.523      544-544/com.android.phone D/dalvikvm﹕ GC_FOR_ALLOC freed 366K, 15% free 3405K/4004K, paused 84ms, total 85ms
        01-04 05:37:49.543      396-572/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.543      396-572/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.543      396-572/system_process I/PackageManager﹕ Scheme: "smsto"
        01-04 05:37:49.543      396-572/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.643      396-500/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.663      396-500/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.663      396-500/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.663      396-500/system_process I/PackageManager﹕ Scheme: "mms"
        01-04 05:37:49.773      396-442/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:49.773      396-442/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:49.773      396-442/system_process I/PackageManager﹕ Scheme: "mmsto"
        01-04 05:37:49.773      396-442/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:49.953      396-442/system_process D/dalvikvm﹕ GC_FOR_ALLOC freed 1034K, 19% free 6745K/8312K, paused 139ms, total 143ms
        01-04 05:37:50.043      396-499/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:50.043      396-499/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:50.043      396-499/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:50.053      396-499/system_process I/PackageManager﹕ Scheme: "sms"
        01-04 05:37:50.153      396-500/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:50.153      396-500/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:50.153      396-500/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:50.163      396-500/system_process I/PackageManager﹕ Scheme: "smsto"
        01-04 05:37:50.313      544-544/com.android.phone D/dalvikvm﹕ GC_FOR_ALLOC freed 363K, 16% free 3402K/4004K, paused 58ms, total 60ms
        01-04 05:37:50.363      396-408/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:50.363      396-408/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:50.363      396-408/system_process I/PackageManager﹕ Scheme: "mms"
        01-04 05:37:50.363      396-408/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:50.453      396-442/system_process I/PackageManager﹕ Action: "android.intent.action.SENDTO"
        01-04 05:37:50.453      396-442/system_process I/PackageManager﹕ Category: "android.intent.category.DEFAULT"
        01-04 05:37:50.453      396-442/system_process I/PackageManager﹕ Adding preferred activity ComponentInfo{com.android.mms/com.android.mms.ui.ComposeMessageActivity} for user 0 :
        01-04 05:37:50.463      396-442/system_process I/PackageManager﹕ Scheme: "mmsto"
        01-04 05:37:50.633    1537-1537/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
        01-04 05:37:50.663    1537-1537/? D/AndroidRuntime﹕ CheckJNI is ON
        01-04 05:37:50.893    1537-1537/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
        01-04 05:37:50.903    1537-1537/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
        01-04 05:37:50.953    1537-1537/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
        01-04 05:37:50.953    1537-1537/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
        01-04 05:37:50.963    1537-1537/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
        01-04 05:37:51.093      396-412/system_process W/RecognitionManagerService﹕ no available voice recognition services found for user 0
        01-04 05:37:51.393    1537-1537/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
        01-04 05:37:52.003    1537-1537/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
        01-04 05:37:52.003    1537-1537/? E/android.os.Debug﹕ failed to load memtrack module: -2
        01-04 05:37:52.393    1537-1537/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
        01-04 05:37:52.473      396-408/system_process I/ActivityManager﹕ Force stopping com.PacchettoPrincipale.app appid=10052 user=-1: set debug app
        01-04 05:37:52.473      396-408/system_process I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.PacchettoPrincipale.app/.Login} from pid 1537
        01-04 05:37:52.533        51-51/? D/gralloc﹕ Registering a buffer in the process that created it. This may cause memory ordering problems.
        01-04 05:37:52.533        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.543        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.543        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.543        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.543        51-51/? E/SurfaceFlinger﹕ glCheckFramebufferStatusOES error 715018613
        01-04 05:37:52.543        51-51/? E/SurfaceFlinger﹕ got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
        01-04 05:37:52.543        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.543        51-51/? E/libEGL﹕ called unimplemented OpenGL ES API
        01-04 05:37:52.603      396-408/system_process W/WindowManager﹕ Screenshot failure taking screenshot for (246x410) to layer 21010
        01-04 05:37:52.683    1537-1537/? D/AndroidRuntime﹕ Shutting down VM
        01-04 05:37:52.693    1537-1543/? D/jdwp﹕ Got wake-up signal, bailing out of select
        01-04 05:37:52.693    1537-1543/? D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
        01-04 05:37:52.813      396-572/system_process I/ActivityManager﹕ Start proc com.PacchettoPrincipale.app for activity com.PacchettoPrincipale.app/.Login: pid=1547 uid=10052 gids={50052, 3003}
        01-04 05:37:52.853    1547-1547/com.PacchettoPrincipale.app D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
        01-04 05:37:53.483    1547-1547/com.PacchettoPrincipale.app W/ActivityThread﹕ Application com.PacchettoPrincipale.app is waiting for the debugger on port 8100...
        01-04 05:37:53.533    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ Sending WAIT chunk
        01-04 05:37:53.553    1547-1553/com.PacchettoPrincipale.app I/dalvikvm﹕ Debugger is active
        01-04 05:37:53.733    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ Debugger has connected
        01-04 05:37:53.733    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:53.813      396-410/system_process I/Choreographer﹕ Skipped 35 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:54.003      396-410/system_process I/Choreographer﹕ Skipped 47 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:54.073    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:54.283    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:54.383      396-410/system_process I/Choreographer﹕ Skipped 97 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:54.493    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:54.703    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:54.863      396-411/system_process I/Choreographer﹕ Skipped 141 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:54.903    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:54.993      396-410/system_process I/Choreographer﹕ Skipped 47 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:55.223    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:55.433    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:55.433      396-411/system_process I/Choreographer﹕ Skipped 138 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:55.463      396-410/system_process I/Choreographer﹕ Skipped 50 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:55.643    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:55.873    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:56.073    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ waiting for debugger to settle...
        01-04 05:37:56.123      396-410/system_process I/Choreographer﹕ Skipped 51 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:56.133      396-411/system_process I/Choreographer﹕ Skipped 94 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:56.283    1547-1547/com.PacchettoPrincipale.app I/System.out﹕ debugger has settled (1315)
        01-04 05:37:56.283      396-410/system_process I/Choreographer﹕ Skipped 41 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:57.203      396-411/system_process I/Choreographer﹕ Skipped 65 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:58.053      396-410/system_process I/Choreographer﹕ Skipped 45 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:58.773      396-410/system_process I/Choreographer﹕ Skipped 36 frames!  The application may be doing too much work on its main thread.
        01-04 05:37:58.793      396-430/system_process E/NetdConnector﹕ NDC Command {74 bandwidth gettetherstats} took too long (588ms)
        01-04 05:37:59.303      396-435/system_process D/MobileDataStateTracker﹕ default: setPolicyDataEnable(enabled=true)
        01-04 05:38:00.733    1547-1547/com.PacchettoPrincipale.app D/gralloc_goldfish﹕ Emulator without GPU emulation detected.
        01-04 05:38:00.933      396-410/system_process I/ActivityManager﹕ Displayed com.PacchettoPrincipale.app/.Login: +8s179ms
        01-04 05:38:10.983      396-460/system_process D/LightsService﹕ Excessive delay setting light: 103ms
        01-04 05:39:33.723      396-659/system_process D/LightsService﹕ Excessive delay setting light: 68ms
        01-04 05:39:34.053      396-659/system_process D/LightsService﹕ Excessive delay setting light: 73ms
        01-04 05:39:36.323      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.323      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.323      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.333      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.333      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.333      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.343      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.343      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.343      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.353      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:36.353      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressStandard.ogg
        01-04 05:39:36.353      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
        01-04 05:39:36.353      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressSpacebar.ogg
        01-04 05:39:36.353      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
        01-04 05:39:36.353      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressDelete.ogg
        01-04 05:39:36.353      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
        01-04 05:39:36.353      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressReturn.ogg
        01-04 05:39:36.363      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
        01-04 05:39:36.363      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressInvalid.ogg
        01-04 05:39:36.363      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
        01-04 05:39:36.363      396-440/system_process W/AudioService﹕ onLoadSoundEffects(), Error -1 while loading samples
        01-04 05:39:36.403      396-572/system_process I/ActivityManager﹕ START u0 {cmp=com.PacchettoPrincipale.app/.Register} from pid 1547
        01-04 05:39:36.703    1547-1547/com.PacchettoPrincipale.app I/Choreographer﹕ Skipped 66 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:39.623    1547-1547/com.PacchettoPrincipale.app I/Choreographer﹕ Skipped 109 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:40.583      396-410/system_process I/Choreographer﹕ Skipped 35 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:40.613      396-410/system_process I/ActivityManager﹕ Displayed com.PacchettoPrincipale.app/.Register: +4s157ms
        01-04 05:39:40.803      396-410/system_process I/Choreographer﹕ Skipped 31 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:40.943      396-410/system_process I/Choreographer﹕ Skipped 35 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:41.073      396-410/system_process I/Choreographer﹕ Skipped 32 frames!  The application may be doing too much work on its main thread.
        01-04 05:39:42.493      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.493      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.513      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.513      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.523      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.533      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.533      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.533      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.533      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.533      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
        01-04 05:39:42.553      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressStandard.ogg
        01-04 05:39:42.553      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
        01-04 05:39:42.573      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressSpacebar.ogg
        01-04 05:39:42.573      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
        01-04 05:39:42.583      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressDelete.ogg
        01-04 05:39:42.583      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
        01-04 05:39:42.583      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressReturn.ogg
        01-04 05:39:42.583      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
        01-04 05:39:42.583      396-440/system_process E/SoundPool﹕ error loading /system/media/audio/ui/KeypressInvalid.ogg
        01-04 05:39:42.593      396-440/system_process W/AudioService﹕ Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
        01-04 05:39:42.593      396-440/system_process W/AudioService﹕ onLoadSoundEffects(), Error -1 while loading samples
        01-04 05:39:42.953    1547-1547/com.PacchettoPrincipale.app D/dalvikvm﹕ GC_FOR_ALLOC freed 123K, 7% free 3135K/3344K, paused 43ms, total 56ms
        01-04 05:39:42.953    1547-1547/com.PacchettoPrincipale.app I/dalvikvm-heap﹕ Grow heap (frag case) to 3.749MB for 635812-byte allocation
        01-04 05:39:43.033    1547-1556/com.PacchettoPrincipale.app D/dalvikvm﹕ GC_FOR_ALLOC freed 6K, 6% free 3750K/3968K, paused 43ms, total 43ms
        01-04 05:39:43.653    1547-1547/com.PacchettoPrincipale.app I/Choreographer﹕ Skipped 69 frames!  The application may be doing too much work on its main thread.

哪里可能是错误?

2 个答案:

答案 0 :(得分:1)

更改此

  new LoadFermate(getApplicationContext()).execute();

 new LoadFermate(Register.this).execute();

编辑:

Toast are not shown

请致电show()

 Toast.makeText(this.context , testo, Toast.LENGTH_SHORT).show(); 
 // forgot to call show

请参阅Commonsware,回答关于COntext的更好的解释

When to call activity context OR application context?

答案 1 :(得分:0)

您正在onCreate中调用您的异步任务;试着把它放在onResume中。 onCreate仅用于创建UI,不用于进行任何网络调用。