2012-06-01 65 views
1

我的應用程序在我的模擬器出現之前出現問題。解鎖後,我可以看到它並點擊它。但現在,它沒有顯示。我搜索了幾乎幾個小時,但無濟於事。請我需要你的幫助,以便我可以繼續前進。謝謝。我的清單文件似乎沒問題,沒有錯誤。而我的源代碼也不會有錯誤。我的應用程序沒有顯示在模擬器中

Splash.java

public class Splash extends Activity{ 

    //MediaPlayer ourSong; // for our splash background song 

    @Override 
    protected void onCreate(Bundle iHF) { 
     super.onCreate(iHF); 
     setContentView(R.layout.splash); 

      Thread timer = new Thread(){ 
       public void run(){ 
        try{ 
         sleep(1000); // sleeps/delays for 1 second 
        } // end try 
        catch(InterruptedException e){ 
         e.printStackTrace(); 
        }finally{ 
         // this is going to create new intent activity for Ihealthfirst 
         // based on the action name (com.fps.ihealthfirst.IHEALTHFIRST) 
         Intent openIHealthFirst = new Intent("com.fps.iHealthFirst.IHEALTHFIRSTACTIVITY"); 
         startActivity(openIHealthFirst); 
        }// end finally 
       } // end run method 
      }; // end thread 

      timer.start(); 
     } // end onCreate method 

    @Override 
    protected void onPause() { 
     super.onPause(); 
     finish(); 
    } 



    } // end Splash class 

清單

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.fps.iHealthFirst" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="10" /> 

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:name=".Splash" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
      </intent-filter>   
     </activity> 


    </application> 

</manifest> 

main.xml中

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:text="Welcome!" /> 

</LinearLayout> 

splash.xml

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


</LinearLayout> 
+0

您可能沒有編譯錯誤。 但我們仍然需要查看您的啓動活動和清單。 –

+0

檢查控制檯,可能會有一些錯誤。 –

+0

我已經編輯過我的文章。請檢查。謝謝。 –

回答

3

嘗試更換您的清單這一行的情況:

<category android:name="android.intent.category.DEFAULT"/>

這樣:

<category android:name="android.intent.category.LAUNCHER"/>

就像現在一樣,您沒有定義啓動器活動。如果您希望保留DEFAULT選項,您可以添加我發佈的行而不是替換它。

+0

感謝它已經修復。 –

0

嘗試這些:

  • 重新啓動仿真
  • 如果不起作用,重新創建模擬器
  • 如果沒有按不起作用,請重新啓動IDE
  • 如果不工作,檢查是否是與所有其他應用
+0

感謝您的快速響應,但我已經做了你所說的。它仍然不起作用。 –

+0

是的,他們是.. –

+0

如果其他應用程序運行正常,那麼在我們的代碼中存在某種問題。請發佈主要活動,主要的XML和清單... – GAMA

相關問題