1

Just started learning android app develpoment. getting error "android.content.activitynotfoundexception no activity found"

Code:- my Android Mainfest

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".SplashScreen"
            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>


        <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".StartingPointActivity"
            android:label="@string/app_name" >
            <intent-filter>
                 <action android:name="com.GTC.STARTINGPOINTACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

</manifest>

and my Splash Screen.java

package com.example.gtctest;

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

public class SplashScreen extends Activity {

    @Override
    protected void onCreate(Bundle splashBundle) {
        // TODO Auto-generated method stub
        super.onCreate(splashBundle);
        setContentView(R.layout.splash);

        Thread timer=new Thread() {

            public void run() {
                try {
                    sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    Intent openStartingPointActivityIntent=new Intent("com.GTC.STARTINGPOINTACTIVITY");
                    startActivity(openStartingPointActivityIntent);
                }
            }
        };
        timer.start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        finish();
    }

}

error:-

09-15 14:31:19.587: E/AndroidRuntime(1088): FATAL EXCEPTION: Thread-123
09-15 14:31:19.587: E/AndroidRuntime(1088): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.GTC.STARTINGPOINTACTIVITY }
09-15 14:31:19.587: E/AndroidRuntime(1088):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
09-15 14:31:19.587: E/AndroidRuntime(1088):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
09-15 14:31:19.587: E/AndroidRuntime(1088):     at android.app.Activity.startActivityForResult(Activity.java:3190)
09-15 14:31:19.587: E/AndroidRuntime(1088):     at android.app.Activity.startActivity(Activity.java:3297)
09-15 14:31:19.587: E/AndroidRuntime(1088):     at com.example.gtctest.SplashScreen$1.run(SplashScreen.java:28)

Cant't figure out what is wrong.please help to solve this issue And one more question In android mainfest the name action name can be anything or it has to be path from package like "com.GTC.classname"

4 Answers 4

0

you have two application tags in your manifest. change it to one with both activities

2
  • Thanks a lot... Can you please tell that action name can be anything or it should be path like packagename.classname??
    – Sumeet
    Sep 15, 2014 at 9:19
  • I'm not that familiar with action name. I usually use <action android:name="android.intent.action.VIEW" /> . maybe this link helps: developer.android.com/guide/topics/manifest/action-element.html
    – Ivo
    Sep 15, 2014 at 9:24
0

please modify your manifest like this:

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".SplashScreen"
            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=".StartingPointActivity"
            android:label="@string/app_name" >
            <intent-filter>
                 <action android:name="com.GTC.STARTINGPOINTACTIVITY" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
</manifest>

ps: in android mainfest, the action name can be anything, but we used to make it like "com.xxx.intent.action.XXX".

1
  • @Sumeet it can be anything, but we used to make it like "com.xxx.intent.action.XXX"
    – Euporie
    Sep 15, 2014 at 9:26
0

Try this way,hope this will help you to solve your problem.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.gtctest"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".SplashScreen"
            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>


    <activity
        android:name=".StartingPointActivity"
        android:label="@string/app_name"/>

</manifest>

public class SplashScreen extends Activity {

    @Override
    protected void onCreate(Bundle splashBundle) {
        // TODO Auto-generated method stub
        super.onCreate(splashBundle);
        setContentView(R.layout.splash);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(SplashScreen.this,StartingPointActivity.class);
                startActivity(intent);
                finish();
            }
        },3000);
    }

    @Override
    protected void onPause() {
        super.onPause();
    }
}
0

Create Intent Like Following...

Intent intentname =new Intent(SplashScreen.this,StartingPointActivity.class);
startActivity(intentname);

Change in your AndroidManifest.xml File..

You have defined two <application> tag....

remove that and change it to following..

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

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".SplashScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- add new activities like this -->
        <activity
            android:name=".StartingPointActivity"
            android:label="@string/app_name" >

        <!-- if your activity in different package you can define like this... (xx.xxx is your package name define your package name there..) 
        <activity
            android:name="xx.xxx.StartingPointActivity"
            android:label="@string/app_name" > 
         -->

    </application>

</manifest>
2
  • is it STARTINGPOINTACTIVITY.class or StartingPointActivity.class while creating intent for navigate 2 StartingPointActivity?
    – Kaushik
    Sep 15, 2014 at 9:47
  • so please change that according to the class name in manifest
    – Kaushik
    Sep 15, 2014 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.