Search code examples
androidemulationandroid-2.3-gingerbread

my application is not showing up in the emulator


I have a problem with my app, before it was showing up in my emulator. After I unlocked it i could see it and click on it. But now, it's not showing. I googled for almost hours but to no avail. Please I need your help so I can move on. Thanks. My manifest file seems okay, no error. And my source codes don't also have errors.

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

manifest

<?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>

Solution

  • Try replacing this line in your manifest:

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

    to this:

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

    As it is now, you don't have a launcher activity defined. If you wish to keep the DEFAULT option, you can add the line I posted rather than replacing it.