0

I'm quite new with android, and it's the first time that I use AsyncTask. I can't find the error with the debug because the debugger enters just in onPreExecute method and not in doInBackground method. So I think that the error is one of the 2 methods, but I cannot understand in what of the 2.

Here is the code of this class:

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();
        }


    }
}

an I call it from the other class passing the context: new LoadFermate(getApplicationContext()).execute();

Here a piece of code of the Register class, where I call the AsyncTask. I have put it in the onCreate just because I was doing a test before implement it finally.

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> { [...]}


}

and 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.

Where could be the error?

giacomotb
  • 477
  • 3
  • 8
  • 22

2 Answers2

1

Change this

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

to

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

Edit:

Toast are not shown

So call show()

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

See Commonsware answer better explanation than mine about COntext

When to call activity context OR application context?

Community
  • 1
  • 1
Raghunandan
  • 129,147
  • 24
  • 216
  • 249
0

You're calling your async task in onCreate; try to put it in onResume. onCreate is only for UI creation not for making any network calls.

Niall C.
  • 10,718
  • 7
  • 66
  • 60
  • 1
    `new LoadFermate(Register.this).execute();`.??. Register is a Activity – Raghunandan Jan 04 '14 at 10:19
  • "onCreate is only for ui creation not making any network calls" There is not network call made. Asynctask is invoked on the ui thread in `onCreate`. You are wrong – Raghunandan Jan 04 '14 at 10:27
  • @Raghunandan I put Register.this becaus a question now deleted suggested me that, and I moved the call to onClick method – giacomotb Jan 04 '14 at 10:39
  • @giacomotb i only suggested that. I wanted to be sure before posting an answer. With this `new LoadFermate(Register.this).execute();` what happens. Does it still crash?? – Raghunandan Jan 04 '14 at 10:40
  • @giacomotb no toast meaning you see nothing?? just put a log statemnt in onpostExecute. `Log.i("I am here","onpostExecute");`. see the log and tell me – Raghunandan Jan 04 '14 at 10:43
  • @Raghunandan JSONObject json = jParser.getJSONFromUrl(DOWNLOAD_FERMATE_URL); is network call – user3146306 Jan 04 '14 at 10:48
  • @user3146306 that is in the background thread. read asynctask docs. Network call is not made in activity. its done in doInbackground which is invoked on the backgroudn thread. there is no har, in invoking asynctask in `onCreate`. you are wrong – Raghunandan Jan 04 '14 at 10:49
  • @giacomotb you forgot to call `show()` for the toast. see my post – Raghunandan Jan 04 '14 at 10:49
  • i m very sorry but async task is as name suggest its asynchronus, blocker call, – user3146306 Jan 04 '14 at 10:53
  • @Raghunandan ok, that one is a my very silly error. Thank you for the help. – giacomotb Jan 04 '14 at 10:54
  • @user3146306 it is asynchronous. it does not block the ui thread ie asynchronous – Raghunandan Jan 04 '14 at 10:55