CERCA
PER MODELLO
FullScreen Chatbox! :)

Utente del giorno: megthebest con ben 1 Thanks ricevuti nelle ultime 24 ore
Utente della settimana: megthebest con ben 4 Thanks ricevuti negli ultimi sette giorni
Utente del mese: megthebest con ben 21 Thanks ricevuti nell'ultimo mese

Visualizzazione dei risultati da 1 a 7 su 7
Discussione:

Spiacenti! Interruzione imprevista dell'applicazione activity_name(package) Riprova

Se questa discussione ti è stata utile, ti preghiamo di lasciare un messaggio di feedback in modo che possa essere preziosa in futuro anche per altri utenti come te!
  1. #1
    Baby Droid


    Registrato dal
    Jun 2011
    Messaggi
    10

    Ringraziamenti
    0
    Ringraziato 0 volte in 0 Posts
    Predefinito

    Spiacenti! Interruzione imprevista dell'applicazione activity_name(package) Riprova

    sono uno studente di ICD a bari e sto imparando a sviluppare con android, per la teoria sto utilizzando il buon libro dell'apogeo e, arrivati al capitolo 04, quello per la gestione di più attività con le intent mi propone un esempio ma nell'emulatore mi compare una schermata con scritto: "Spiacenti! Interruzione imprevista dell'applicazione LyfecicleActivitytest (processoit.apogeo.cap04.LifeCycleActivityTest).Ri prova" con un tasto che mi consente di terminare forzatamente l'applcazione, volevo sapere di che genere di problema si tratta e come si potrebbe risolvere, comunque se volete posto anche il codice completo del progetto così potete capire se sono io a sbagliare o può essere un problema di qualche altro genere, vi ringrazio anticipatamente per l'aiuto.
    Ultima modifica di sgaglio88; 21-06-11 alle 11:20

  2.  
  3. #2
    Baby Droid


    Registrato dal
    Jun 2011
    Messaggi
    10

    Ringraziamenti
    0
    Ringraziato 0 volte in 0 Posts
    Predefinito

    ragazzi perchè non mi rispondete??penso che questo non sia solo un problema mio ma di molti che stanno cominciando a programmare in android!! non riesco ancora a risolverlo...HELP ME PLEASE!!!:S

  4. #3
    Androidiano L'avatar di Jordano


    Registrato dal
    Nov 2010
    Località
    Reggio Emilia
    Messaggi
    263
    Smartphone
    Nexus S / HTC Magic 32a

    Ringraziamenti
    1
    Ringraziato 48 volte in 46 Posts
    Predefinito

    metti un pò di codice e l'output di logcat

  5. #4
    Baby Droid


    Registrato dal
    Jun 2011
    Messaggi
    10

    Ringraziamenti
    0
    Ringraziato 0 volte in 0 Posts
    Predefinito

    Allora questa è l'attività principale che si chiama LifeCycleActivityTestActivity:

     
    1
    2
    package it.apogeo.android.cap04.LifeCycleActivityTest;
    3
    4
    import android.app.Activity;
    5
    import android.content.Intent;
    6
    import android.os.Bundle;
    7
    import android.util.Log;
    8
    import android.view.View;
    9
    import android.view.View.OnClickListener;
    10
    import android.widget.Button;
    11
    import android.widget.TextView;
    12
    13
    public class LifeCycleActivityTestActivity extends Activity {
    14
    15
        // Valore per il Tag del Log
    16
        private final static String ACTIVITY_TAG = "LIFECYCLE_TEST";
    17
    18
        // Contatore che descrive un possibile stato
    19
        protected int counter = 0;
    20
    21
        /** Called when the activity is first created. */
    22
        @Override
    23
        protected void onCreate(Bundle savedInstanceState) {
    24
            super.onCreate(savedInstanceState);
    25
            // Visualizziamo messaggio di Log
    26
            Log.i(ACTIVITY_TAG, "ON_CREATE " + getActivityName());
    27
            // Impostiamo il Layout
    28
            setContentView(R.layout.main);
    29
            // Bottone che permette di visualizzare la seconda Activity
    30
            Button navButton = (Button) findViewById(R.id.navButton);
    31
            navButton.setOnClickListener(new OnClickListener() {
    32
    33
                @Override
    34
                public void onClick(View arg0) {
    35
                    // Andiamo in modo esplicito alla seconda
    36
                    // Activity
    37
                    Log.i(ACTIVITY_TAG, "LAUNCHING SECOND ACTIVITY ");
    38
                    Intent intent = new Intent(LifeCycleActivityTestActivity.this,
    39
                            SecondActivity.class);
    40
                    startActivity(intent);
    41
                    
    42
                }
    43
    44
    45
            });
    46
            // Bottone che permette di terminare l'attività corrente
    47
            Button killButton = (Button) findViewById(R.id.killButton);
    48
            killButton.setOnClickListener(new OnClickListener() {
    49
                @Override
    50
                public void onClick(View arg0) {
    51
                    Log.i(ACTIVITY_TAG, "finish() on " + getActivityName());
    52
                    finish();
    53
                }
    54
            });
    55
            // Bottone che incrementa il contatore come stato della attività
    56
            Button countButton = (Button) findViewById(R.id.countButton);
    57
            countButton.setOnClickListener(new OnClickListener() {
    58
                @Override
    59
                public void onClick(View arg0) {
    60
                    Log.i(ACTIVITY_TAG, "finish() on " + getActivityName());
    61
                    counter++;
    62
                    showCounterState();
    63
                }
    64
            });
    65
            showCounterState();
    66
        }
    67
    68
        @Override
    69
        protected void onSaveInstanceState(Bundle outState) {
    70
            super.onSaveInstanceState(outState);
    71
            Log.i(ACTIVITY_TAG, "ON_SAVE_INSTANCE_STATE " + getActivityName());
    72
            // Salviamo lo stato del contatore
    73
            outState.putInt("counter", counter);
    74
        }
    75
    76
        protected void onRestoreInstanceState(Bundle savedInstanceState) {
    77
            super.onSaveInstanceState(savedInstanceState);
    78
            Log.i(ACTIVITY_TAG, "ON_RESTORE_INSTANCE_STATE " + getActivityName());
    79
            counter = savedInstanceState.getInt("counter");
    80
            showCounterState();
    81
        }
    82
    83
        protected String getActivityName() {
    84
            return "FIRST ACTIVITY";
    85
        }
    86
    87
        @Override
    88
        protected void onDestroy() {
    89
            super.onDestroy();
    90
            Log.i(ACTIVITY_TAG, "ON_DESTROY " + getActivityName());
    91
        }
    92
    93
        @Override
    94
        protected void onPause() {
    95
            super.onPause();
    96
            Log.i(ACTIVITY_TAG, "ON_PAUSE " + getActivityName());
    97
        }
    98
    99
        @Override
    100
        protected void onRestart() {
    101
            super.onRestart();
    102
            Log.i(ACTIVITY_TAG, "ON_RESTART" + getActivityName());
    103
        }
    104
    105
        @Override
    106
        protected void onResume() {
    107
            super.onResume();
    108
            Log.i(ACTIVITY_TAG, "ON_RESUME " + getActivityName());
    109
        }
    110
    111
        @Override
    112
        protected void onStart() {
    113
            super.onStart();
    114
            Log.i(ACTIVITY_TAG, "ON_START " + getActivityName());
    115
        }
    116
    117
        @Override
    118
        protected void onStop() {
    119
            super.onStop();
    120
            Log.i(ACTIVITY_TAG, "ON_STOP " + getActivityName());
    121
        }
    122
    123
        // Metodo di utilità che permette la visualizzazione dello stato del
    124
        // contatore nella TextView
    125
        private void showCounterState() {
    126
            TextView textView = (TextView) findViewById(R.id.counterValue);
    127
            textView.setText(" Counter: " + counter);
    128
        }
    129
    130
    }
    131



    Questa è l'attività secondaria(SecondActivity):

    24
     
    1
    package it.apogeo.android.cap04.LifeCycleActivityTest;
    2
    3
    4
    import android.os.Bundle;
    5
    import android.widget.TextView;
    6
    7
    public class SecondActivity extends LifeCycleActivityTestActivity {
    8
    9
        @Override
    10
        protected void onCreate(Bundle savedInstanceState) {
    11
            // TODO Auto-generated method stub
    12
            super.onCreate(savedInstanceState);
    13
            TextView output = (TextView)findViewById(R.id.output);
    14
            String text = getResources().getString(R.string.second_label);
    15
            output.setText(text);
    16
        }
    17
        
    18
        protected String getActivityName(){
    19
            return "SECOND ACTIVITY";
    20
        }   
    21
        
    22
    23
    }
    24


    Questo è il manifest:

    18
     
    1
    <?xml version="1.0" encoding="utf-8"?>
    2
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    3
              package="it.apogeo.android.cap04.LifeCycleActivity  Test" 
    4
              android:versionCode="1" 
    5
              android:versionName="1.0">
    6
    -      <application android:icon="@drawable/icon" android:label="@string/app_name">
    7
    -         <activity android:name=".LifeCyleActivityTestActivity" android:label="@string/app_name" android:launchMode="standard">
    8
    -           <intent-filter>
    9
                  <action android:name="android.intent.action.MAIN" /> 
    10
                    <category android:name="android.intent.category.LAUNCHER" /> 
    11
                </intent-filter>
    12
              </activity>
    13
    - <!--  activity android:name="SecondActivity" android:process=":new_process"></activity
    14
      --> 
    15
            <activity android:name="SecondActivity" /> 
    16
          </application>
    17
      <uses-sdk android:minSdkVersion="3" /> 
    18
      </manifest>

  6. #5
    Androidiano L'avatar di Jordano


    Registrato dal
    Nov 2010
    Località
    Reggio Emilia
    Messaggi
    263
    Smartphone
    Nexus S / HTC Magic 32a

    Ringraziamenti
    1
    Ringraziato 48 volte in 46 Posts
    Predefinito

    logcat cosa dice così facciamo prima?

  7. #6
    Baby Droid


    Registrato dal
    Jun 2011
    Messaggi
    10

    Ringraziamenti
    0
    Ringraziato 0 volte in 0 Posts
    Predefinito

    L'HO POSTATO MA NON ME LO FANNO VISUALIZZARE FINCHE' UN MODERATORE NON MI DARA' IL CONSENSO CMQ QUESTI SONO GLI ERRORI DEL LOGCAT CHE MI SI PRESENTANO:


    06-21 10:53:50.154: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test2' (No such file or directory)
    06-21 10:53:50.154: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test2' (m)
    06-21 10:53:50.154: ERROR/vold(538): Error opening switch name path '/sys/class/switch/test' (No such file or directory)
    06-21 10:53:50.154: ERROR/vold(538): Error bootstrapping switch '/sys/class/switch/test' (m)
    06-21 10:53:50.284: ERROR/flash_image(544): can't find recovery partition
    06-21 10:54:00.475: ERROR/MemoryHeapBase(563): error opening /dev/pmem: No such file or directory
    06-21 10:54:00.475: ERROR/SurfaceFlinger(563): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
    06-21 10:54:00.574: ERROR/GLLogger(563): couldn't load <libhgl.so> library (Cannot find library)
    06-21 10:54:00.684: ERROR/GLLogger(563): couldn't load <libhgl.so> library (Cannot find library)
    06-21 10:54:04.554: ERROR/BatteryService(563): Could not open '/sys/class/power_supply/usb/online'
    06-21 10:54:04.554: ERROR/BatteryService(563): Could not open '/sys/class/power_supply/battery/batt_vol'
    06-21 10:54:04.554: ERROR/BatteryService(563): Could not open '/sys/class/power_supply/battery/batt_temp'
    06-21 10:54:05.173: ERROR/EventHub(563): could not get driver version for /dev/input/mouse0, Not a typewriter
    06-21 10:54:05.203: ERROR/System(563): Failure starting core service
    06-21 10:54:05.203: ERROR/System(563): java.lang.SecurityException
    06-21 10:54:05.203: ERROR/System(563): at android.os.BinderProxy.transact(Native Method)
    06-21 10:54:05.203: ERROR/System(563): at android.os.ServiceManagerProxy.addService(ServiceM anagerNative.java:146)
    06-21 10:54:05.203: ERROR/System(563): at android.os.ServiceManager.addService(ServiceManage r.java:72)
    06-21 10:54:05.203: ERROR/System(563): at com.android.server.ServerThread.run(SystemServer.j ava:163)
    06-21 10:54:05.213: ERROR/EventHub(563): could not get driver version for /dev/input/mice, Not a typewriter
    06-21 10:54:05.213: ERROR/AndroidRuntime(563): Crash logging skipped, no checkin service
    06-21 10:54:06.333: ERROR/LockPatternKeyguardView(563): Failed to bind to GLS while checking for account
    06-21 10:54:09.484: ERROR/ApplicationContext(563): Couldn't create directory for SharedPreferences file shared_prefs/wallpaper-hints.xml
    06-21 10:54:16.215: ERROR/MediaPlayerService(542): Couldn't open fd for content://settings/system/notification_sound
    06-21 10:54:16.235: ERROR/MediaPlayer(563): Unable to to create media player
    06-21 10:54:10.123: ERROR/ActivityThread(612): Failed to find provider info for android.server.checkin
    06-21 10:54:11.443: ERROR/ActivityThread(612): Failed to find provider info for android.server.checkin
    06-21 10:54:11.653: ERROR/ActivityThread(612): Failed to find provider info for android.server.checkin
    06-21 10:54:15.202: ERROR/AndroidRuntime(716): Uncaught handler: thread main exiting due to uncaught exception
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{it.apogeo.android.cap04.LifeCycleAct ivityTest/it.apogeo.android.cap04.LifeCycleActivityTest.Life CyleActivityTestActivity}: java.lang.ClassNotFoundException: it.apogeo.android.cap04.LifeCycleActivityTest.Life CyleActivityTestActivity in loader dalvik.system.PathClassLoader@43598b58
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2194)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:2284)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread.access$1800(ActivityThr ead.java:112)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1692)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.os.Handler.dispatchMessage(Handler.java:99 )
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.os.Looper.loop(Looper.java:123)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread.main(ActivityThread.jav a:3948)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at java.lang.reflect.Method.invokeNative(Native Method)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at java.lang.reflect.Method.invoke(Method.java:521)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:782)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:540)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at dalvik.system.NativeStart.main(Native Method)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): Caused by: java.lang.ClassNotFoundException: it.apogeo.android.cap04.LifeCycleActivityTest.Life CyleActivityTestActivity in loader dalvik.system.PathClassLoader@43598b58
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at dalvik.system.PathClassLoader.findClass(PathClassL oader.java:243)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at java.lang.ClassLoader.loadClass(ClassLoader.java:5 73)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at java.lang.ClassLoader.loadClass(ClassLoader.java:5 32)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.Instrumentation.newActivity(Instrument ation.java:1097)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:2186)
    06-21 10:54:15.222: ERROR/AndroidRuntime(716): ... 11 more


    GRAZIE PER L'AIUTO

  8. #7
    Baby Droid


    Registrato dal
    Jun 2011
    Messaggi
    10

    Ringraziamenti
    0
    Ringraziato 0 volte in 0 Posts
    Predefinito

    Problema risolto!!! Nel manifest non dichiaravo bene tutte le attività con le relative label e non trovandole mi dava errore a run-time!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire risposte
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Torna su
Privacy Policy