[Developement Eclipse] sorry the application has been stopped

sifokl Messages postés 28 Statut Membre -  
scinarf Messages postés 1183 Statut Membre -
Bonjour , je suis debutant , et je commence a developper une appli ,
au debut je voudrais lancer une pub durant 2,5 secondes avant de passer a 'activité principale , mais apres avoir passé la pub , l'appli se plante !

voici : le main : MainActivity.java
package com.xenasoft.mescopainsdabordphone;

import android.os.Bundle;
import android.app.Activity;

public class MainActivity extends Activity {

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


et ceci est le splash (la pub) qui doit se lancer avant :
package com.xenasoft.mescopainsdabordphone;

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

public class Splash extends Activity{

	protected void onCreate(Bundle BundleSplash){
		super.onCreate(BundleSplash);
		setContentView(R.layout.splash);
		Thread timer = new Thread(){
			public void run(){
				try {
					sleep(2500);
				}catch (InterruptedException e){
					e.printStackTrace();
				}finally{
					Intent toMain = new Intent("com.xenasoft.mescopainsdabordphone.MAINACTIVITY");
					startActivity(toMain);
				}
			}
		};
		timer.start();
	}
	


et ceci le manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xenasoft.mescopainsdabordphone"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
        <activity android:name=".Splash" 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=".MainActivity" android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAINACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
          </activity>
         
    </application>

</manifest>


quelqun peut m'aider ?
merci d'avance

1 réponse

Discussions similaires