Android中的黑屏显示(启动画面)

时间:2016-04-17 22:05:07

标签: android android-studio splash-screen

有什么问题?

我的应用是社交论坛应用。当我尝试登录应用程序时。启动画面后显示黑屏。我该如何解决这个问题?

您尝试了什么?

  1. 当我在模拟器上尝试时。它有时工作,但如果我尝试注销并登录。黑屏来了。

  2. 我改变了睡眠时间(8000-9000-10000)。它有时工作,但当我尝试用用户名和密码登录黑屏来。

  3. 调试模式没有错误,我也检查了ftp日志。

  4. 我在互联网上尝试了其他解决方案,但它没有用。

  5. 这是我的启动活动

    package com.abulletin.forumapp.Activity;
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import com.abulletin.forumapp.R;
    
    public class SplashActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);
    
            getActionBar().hide();
    
            Thread timerThread = new Thread(){
                public void run(){
                    try{
                        sleep(2000);
                    }catch(InterruptedException e){
                        e.printStackTrace();
                    }finally{
                        Intent i = new Intent(getApplicationContext(),MainActivity.class);
                        startActivity(i);
                    }
                }
            };
            timerThread.start();
        }
    
        @Override
        protected void onPause() {
            // TODO Auto-generated method stub
            super.onPause();
            finish();
        }
    }
    

    这是我的清单xml

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.abulletin.forumapp" >
    
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_PHONE_STATE" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.VIBRATE" />
        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.GET_TASKS" />
        <uses-permission android:name="android.permission.WRITE_SETTINGS" />
        <uses-permission android:name="com.mymonas.ngobrol.permission.C2D_MESSAGE" />
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
        <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:name="com.abulletin.forumapp.MyApplication"
            android:logo="@android:color/transparent"
            android:theme="@style/Theme.Blue" >
            <receiver
                android:name="com.abulletin.forumapp.util.GcmBroadcastReceiver"
                android:permission="com.google.android.c2dm.permission.SEND" >
                <intent-filter>
                    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                    <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
    
                    <category android:name="com.mymonas.ngobrol.services" />
                </intent-filter>
            </receiver>
    
            <service android:name="com.abulletin.forumapp.util.GCMNotificationReceiver" />
    
            <activity
                android:name="com.abulletin.forumapp.Activity.MainActivity"
                android:label="@string/app_name" >
            </activity>
    
            <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
    
            <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
    
            <activity
                android:name="com.abulletin.forumapp.Activity.LoginActivity"
                android:label="@string/title_activity_login" >
            </activity>
            <activity
                android:name="com.abulletin.forumapp.Activity.RegisterActivity"
                android:label="@string/title_activity_register" >
            </activity>
            <activity
                android:name="com.abulletin.forumapp.Activity.PostActivity"
                android:label="@string/title_activity_post" >
            </activity>
            <activity android:name="com.abulletin.forumapp.Activity.ProfileActivity" >
            </activity>
            <activity
                android:name="com.abulletin.forumapp.Activity.SettingsActivity"
                android:label="@string/title_activity_settings" >
            </activity>
            <activity
                android:name="com.abulletin.forumapp.Activity.AboutActivity"
                android:label="@string/title_activity_about" >
            </activity>
            <activity android:name="com.abulletin.forumapp.Activity.CategoryThreadActivity" >
            </activity>
            <activity android:name="com.abulletin.forumapp.Activity.AddEditThreadActivity" >
            </activity>
            <activity
                android:name="com.abulletin.forumapp.Activity.EditProfileActivity"
                android:label="@string/profile_menu_edit" >
            </activity>
    
           <!-- <meta-data
                android:name="com.crashlytics.ApiKey"
                android:value="0ab64bea47ca3f35dffbd2c94200fbc26be26009" /> -->
    
            <activity
                android:name="com.abulletin.forumapp.Activity.SplashActivity"
                android:configChanges="orientation|keyboardHidden|screenSize"
                android:label="aBulletin Android Forum"
                android:theme="@style/FullscreenTheme" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
            <activity android:name="com.facebook.LoginActivity"
                android:configChanges="orientation"
                android:screenOrientation="landscape"
                android:label="@string/app_name"
                android:theme="@style/AppTheme"
                />
            <meta-data android:name="com.facebook.sdk.ApplicationId"
                android:value="@string/facebook_app_id"/>
    
            <service android:name="com.parse.PushService" />
    
            <receiver android:name="com.parse.ParseBroadcastReceiver" >
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <action android:name="android.intent.action.USER_PRESENT" />
                </intent-filter>
            </receiver>
    
        </application>
    
    </manifest>
    

1 个答案:

答案 0 :(得分:0)

当你问这个问题时已经有一段时间了,但也许它对某些人有帮助。问题是因为您要用于启动画面的图像。也许你可以在Android工作室的android监视器上看到有类似的错误;

07-18 23:21:02.646 23482-23523/com.example.arslan.appphone W/OpenGLRenderer: Bitmap too large to be uploaded into a texture (2880x5120, max=4096x4096)

这是主要问题。 Android无法使用该大图像运行启动画面。