2017-01-25 6 views
-4

こんにちは、スプラッシュ画面の後に私の主な活動に行くのに問題があり、アプリがクラッシュします。スプラッシュスクリーンはうまく表示されますが、私のアプリはクラッシュするでしょう、私は私のアンドロイドマニフェストで間違っていたかもしれないが、私は確信していないと思う。スプラッシュ画面の後にメインアクティビティに問題が発生すると、アプリがクラッシュする

のAndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.example.test.testing"> 





     <application> 


      android:allowBackup="true" 
      android:icon="@mipmap/ic_launcher" 
      android:label="@string/app_name" 
      android:supportsRtl="true" 
      android:theme="@style/AppTheme"> 
      <!-- Splash screen --> 
      <activity 
       android:name="com.example.test.testing.ui.SplashScreen" 
       android:label="@string/app_name" 
       android:screenOrientation="portrait" 
       android:theme="@android:style/Theme.Black.NoTitleBar" > 
       <intent-filter> 
        <action android:name="android.intent.action.MAIN" /> 

        <category android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
      </activity> 
      <!-- Main activity --> 
      <activity 
       android:name="com.example.test.testing.ui.ListActivity" 
       android:label="@string/app_name" > 
      </activity> 
      <!-- 2nd activity --> 
      <activity android:name=".ui.DetailActivity" /> 

     </application> 



    </manifest> 

SplashScreen.java

package com.example.test.testing.ui; 



import android.app.Activity; 
import android.app.ListActivity; 
import android.content.Intent; 
import android.os.Bundle; 
import android.os.Handler; 

import com.example.test.testing.R; 

public class SplashScreen extends Activity { 

    // Splash screen timer 
    private static int SPLASH_TIME_OUT = 3000; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_splash); 

     new Handler().postDelayed(new Runnable() { 

      /* 
      * Showing splash screen with a timer. This will be useful when you 
      * want to show case your app logo/company 
      */ 

      @Override 
      public void run() { 
       // This method will be executed once the timer is over 
       // Start your app main activity 
       Intent i = new Intent(SplashScreen.this, ListActivity.class); 
       startActivity(i); 

       // close this activity 
       finish(); 
      } 
     }, SPLASH_TIME_OUT); 
    } 

} 

activity_splash.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/splash_image" > 

    <ImageView 
     android:id="@+id/imgLogo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true"/> 


    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:textSize="12dp" 
     android:textColor="#454545" 
     android:gravity="center_horizontal" 
     android:layout_alignParentBottom="true"/> 


</RelativeLayout> 
+1

ポストエラーログしてください。 –

+1

アプリがクラッシュしている場合は、スタックトレースを投稿する必要があります。 –

+0

どこにエラーがありますか? –

答えて

0

こんにちは、アプリケーションのタグを以下のように置き換える必要があります。 -

<application 
android:allowBackup="true" 
android:icon="@mipmap/ic_launcher" 
android:label="@string/app_name" 
android:supportsRtl="true" 
android:theme="@style/AppTheme"> 
<!-- Splash screen --> 
      <activity 
       android:name="com.example.test.testing.ui.SplashScreen" 
       android:label="@string/app_name" 
       android:screenOrientation="portrait" 
       android:theme="@android:style/Theme.Black.NoTitleBar" > 
       <intent-filter> 
        <action android:name="android.intent.action.MAIN" /> 

        <category android:name="android.intent.category.LAUNCHER" /> 
       </intent-filter> 
      </activity> 
      <!-- Main activity --> 
      <activity 
       android:name="com.example.test.testing.ui.ListActivity" 
       android:label="@string/app_name" > 
      </activity> 
      <!-- 2nd activity --> 
      <activity android:name=".ui.DetailActivity" /> 
</application> 
関連する問題