有时应用程序ERROR黑屏启动时启动并且未打开

时间:2013-10-07 22:51:36

标签: java android android-activity logcat splash

我的应用程序有时候不能很好地启动,如果有任何错误或帮助,我会把我的代码放在黑屏上...

public class SplashActivity extends Activity {

    private Context context;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Sense titol
        Config.withoutToolBarAndTitle(this);
        // Obrir activitat
        setContentView(R.layout.activity_menu_splash);
        context = getApplicationContext();

        // COMPROVA SI HI HA IDIOMA NO
        int idioma = Shared.getData(context, Config.TAG_LANGUAGE, Config.getIntegerLanguage(Locale.getDefault().getLanguage()));
        Config.changeLanguage(this, idioma);

        new Thread(new Runnable() {
            @Override
            public void run() {
                DataBaseHelperSqlFromFile dbh = new DataBaseHelperSqlFromFile(context);
                // RECUPERA SI ES LA PRIMERA VEGADA O NO
                if (Shared.getData(context, Config.FIRST_TIME, "yes").equals("yes")) {
                    dbh.deleteDataBase();
                    Shared.saveData(context, Config.FIRST_TIME, "no");
                    Log.info("Firts Time");
                }
                dbh.createDataBase(context);
                dbh.close();
            }
        }).start();

        // COMPROVAR SI HI HA EFECTES DE SO O NO
        if (Shared.getData(this, Config.MUSIC, "true").equals("false")) {
            Config.IS_MUSIC = false;
        } else {
            Config.IS_MUSIC = true;
        }
        Tracker t1 = GoogleAnalytics.getInstance(this).getTracker(getString(R.string.ga_trackingId));
        t1.set(Fields.SCREEN_NAME, "IS_MUSIC = " + Config.IS_MUSIC);
        t1.send(MapBuilder.createAppView().build());

        // COMPROVAR SI HI HA SO O NO
        if (Shared.getData(this, Config.SOUND, "true").equals("false")) {
            Config.IS_SOUND = false;
        } else {
            Config.IS_SOUND = true;
        }
        Tracker t11 = GoogleAnalytics.getInstance(this).getTracker(getString(R.string.ga_trackingId));
        t11.set(Fields.SCREEN_NAME, "IS_SOUND = " + Config.IS_SOUND);
        t11.send(MapBuilder.createAppView().build());

        // COMPROVAR SI HI HA SO O NO
        if (Shared.getData(this, Config.CHOOSE, "false").equals("false")) {
            Config.IS_CHOOSE_LETTERS = false;
        } else {
            Config.IS_CHOOSE_LETTERS = true;
        }
        Tracker t111 = GoogleAnalytics.getInstance(this).getTracker(getString(R.string.ga_trackingId));
        t111.set(Fields.SCREEN_NAME, "IS_CHOOSE_LETTERS = " + Config.IS_CHOOSE_LETTERS);
        t111.send(MapBuilder.createAppView().build());

        new Handler().postDelayed(new Runnable() {
            public void run() {
                int idioma = Shared.getData(context, Config.TAG_LANGUAGE, Config.ENGLISH);
                Config.changeLanguage(SplashActivity.this, idioma);
                startActivity(new Intent(SplashActivity.this, MenuActivity.class));
                finish();
            }
        }, Config.SECONDS_TWO);
    }

    @Override
    public void onBackPressed() {
    }
}

这里我把MANIFEST

<application
        android:allowBackup="true"
        android:icon="@drawable/icona"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.cayrodev.comun.menu.SplashActivity"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</application>

这里我提出了可能的错误......

10-07 23:20:57.981: E/InputDispatcher(1381): Key Dispatching ANR, currentTime=33409276553092
10-07 23:20:57.981: E/InputDispatcher(1381): ANR Window: AppWindowToken 40d201f8 token=HistoryRecord 40db4c48 com.cadev.XifresLletres/com.cayrodev.comun.menu.SplashActivity
10-07 23:20:57.981: E/InputDispatcher(1381): ANR Reason: No touched window
10-07 23:20:57.981: E/InputDispatcher(1381): ANR Event Type: MotionEvent [eventTime=33365128298699]
10-07 23:20:57.981: E/InputDispatcher(1381): ANR Event Action: Down
10-07 23:20:57.981: E/InputDispatcher(1381): DUMP OF DISPATCH STATE:
10-07 23:20:57.981: E/InputDispatcher(1381):   DispatchEnabled: 1
10-07 23:20:57.981: E/InputDispatcher(1381):   DispatchFrozen: 0
10-07 23:20:57.981: E/InputDispatcher(1381):   FocusedApplication: name='AppWindowToken 40d201f8 token=HistoryRecord 40db4c48 com.cadev.XifresLletres/com.cayrodev.comun.menu.SplashActivity', dispatchingTimeout=15000.000ms
10-07 23:20:57.981: E/InputDispatcher(1381):   FocusedWindow: name='<null>'
10-07 23:20:57.981: E/InputDispatcher(1381):   TouchDown: false
10-07 23:20:57.981: E/InputDispatcher(1381):   TouchSplit: false
10-07 23:20:57.981: E/InputDispatcher(1381):   TouchedWindows: <none>
10-07 23:20:57.981: E/InputDispatcher(1381):   Windows:
10-07 23:20:57.981: E/InputDispatcher(1381):     0: name='Window40bb07a8 Keyguard paused=false}', paused=false, hasFocus=false, hasWallpaper=false, visible=false, canReceiveKeys=false, flags=0x10120800, extraFlags=0x00000000, type=0x000007d4, layer=141005, frame=[0,38][480,800], visibleFrame=[0,38][480,800], touchableArea=[0,38][480,800], ownerPid=1381, ownerUid=1000, dispatchingTimeout=15000.000ms
10-07 23:20:57.981: E/InputDispatcher(1381):     1: name='Window40ab5520 StatusBar 
10-07 23:20:57.981: E/InputDispatcher(1381):   MonitoringChannels: <none>
10-07 23:20:57.981: E/InputDispatcher(1381):   InboundQueue: length=2
10-07 23:20:57.981: E/InputDispatcher(1381):   ActiveConnections: <none>
10-07 23:20:57.981: E/InputDispatcher(1381):   AppSwitch: not pending

也许......

10-07 23:39:59.645:E / JavaBinder(1381):!!!失败的粘合剂交易!!!

但我找到了一个失败的BINDER TRANSACTION并说小部件问题...我的飞溅img大小它是106kb ..

0 个答案:

没有答案