2012-06-01 74 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

相关问题