So my android project should show a startup image at first and then start the program but instead it shows a blank black screen .

Here is my code :

My class.java :

package abcd.pack;

import java.util.Timer;

import abcd.pack.R.layout;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Class extends Activity  {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.class);
    }
    Thread timer = new Thread()
    {
        public void run(){

            try{

                sleep(5000);
            timer.start();
            }   catch(InterruptedException e) 
            {
                e.printStackTrace();
            }
            finally{
                Intent openProject1Activity = new Intent ("abcd.PROJECT1ACTIVITY");
                startActivity(openProject1Activity);

            }

            }

        };




    private void setContentView(java.lang.Class<layout> class1) {
        // TODO Auto-generated method stub

    }



}

My android manifest.xml

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

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

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".Project1Activity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="abcd.PROJECT1ACTIVITY" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>

So what am i doing wrong ?

Recommended Answers

All 3 Replies

Hard to say since you failed to post layout of R.layout.class

I think i messed up there because i only have 2 files in my layout and those are background.xml and main.xml . Background contains my image and main contains the main program . So instead of R.layout.class if i put R.layout.background , i get the image but it doesn't go further than that . If i put .main instead of class the program starts but it doesn't works :/ .

You can find Splash Screen example here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.