Reputation: 127
I have program that has splassh page I used intent to pass splash activity to my main activity folder but when I run my program it stop after my splash and here is my splash class and manıfest xml and my logcat
package com.tesbih;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
}catch(InterruptedException e){
e .printStackTrace();
}finally{
Intent openStartingPoint = new Intent ("com.tesbih.TESBIHMAINACTIVITY");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
}
and following my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tesbih"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tesbih.TesbihMainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.TESBIHMAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.tesbih.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>
</application>
</manifest>
moreover here is my logcat
02-23 20:33:40.713: E/AndroidRuntime(5683)android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.tesbih.TESBIHMAINACTIVITY }
Upvotes: 0
Views: 106
Reputation: 26
you can copy and paste the that shown in below
package com.tesbih;
import android.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(3000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent i = new Intent (Splash.this,TesbihMainActivity.class);
startActivity (i);
}
}
};
timer.start();
}
}
Upvotes: 1
Reputation: 1407
android:name="com.tesbih.TesbihMainActivity"
You have above in manifest so you must change
("com.tesbih.TESBIHMAINACTIVITY");
to ("com.tesbih.TesbihMainActivity");
in splash.java
Upvotes: 1
Reputation: 8836
start your activity like this,
Intent openStartingPoint = new Intent (Splash.this,TesbihMainActivity.class);
startActivity(openStartingPoint);
instead of Timer, you can use handler for splash as well.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashScreen.this, TesbihMainActivity.class);
startActivity(i);
// close splash
finish();
}
}, SPLASH_TIME_OUT);
Upvotes: 1