Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 即使在清单中声明了“未找到活动”异常_Java_Android_Eclipse_Thread Safety_Avd - Fatal编程技术网

Java 即使在清单中声明了“未找到活动”异常

Java 即使在清单中声明了“未找到活动”异常,java,android,eclipse,thread-safety,avd,Java,Android,Eclipse,Thread Safety,Avd,这是我的logcat文件,它显示了activity not found exception,尽管我已经在清单文件中声明了它。每当我在eclipse avd中启动我的应用程序时,不幸的是,就会弹出警告。请帮我做这个 12-15 07:42:47.833: E/AndroidRuntime(770): FATAL EXCEPTION: Thread-75 12-15 07:42:47.833: E/AndroidRuntime(770): android.content.ActivityNotFou

这是我的logcat文件,它显示了activity not found exception,尽管我已经在清单文件中声明了它。每当我在eclipse avd中启动我的应用程序时,不幸的是,就会弹出警告。请帮我做这个

12-15 07:42:47.833: E/AndroidRuntime(770): FATAL EXCEPTION: Thread-75
12-15 07:42:47.833: E/AndroidRuntime(770): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=my.example.myproject.SELECTION }
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Activity.startActivityForResult(Activity.java:3370)
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Activity.startActivityForResult(Activity.java:3331)
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Activity.startActivity(Activity.java:3566)
12-15 07:42:47.833: E/AndroidRuntime(770):  at android.app.Activity.startActivity(Activity.java:3534)
12-15 07:42:47.833: E/AndroidRuntime(770):  at my.example.myproject.FullscreenActivity$3.run(FullscreenActivity.java:72)
Java代码和清单文件如下所示

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fullscreen);
        final View controlsView = findViewById(R.id.fullscreen_content_controls);
        final View contentView = findViewById(R.id.fullscreen_content);
        iol = (Button)findViewById(R.id.iolCalculation);
        help = (Button)findViewById(R.id.sHelp);
        about = (Button)findViewById(R.id.sAbout);
        Thread iolthread=new Thread(){
            public void run(){
                try{
                    iol.setOnClickListener(new View.OnClickListener() {


                            @Override
                            public void onClick(View v) {
                                // TODO Auto-generated method stub
                                setContentView(R.layout.selection);
                            }
                    });
                    Intent iolIntent=new Intent("my.example.myproject.SELECTION");
                    startActivity(iolIntent);
                }
                finally{
                    finish();
                }
            }
        };  
        iolthread.start();
清单文件

我是android编程和堆栈溢出的初学者。如果有什么错误,请告诉我。 下面是我的主要xml文件

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    tools:context=".FullscreenActivity" >

    <!--
         The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc.
    -->

    <TextView
        android:id="@+id/fullscreen_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:keepScreenOn="true"/>

    <!--
         This FrameLayout insets its children based on system windows using
         android:fitsSystemWindows.
    -->

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/Black"
        android:fitsSystemWindows="true" >

        <LinearLayout
            android:id="@+id/fullscreen_content_controls"
            style="?buttonBarStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center_horizontal"
            android:background="@color/black_overlay"
            android:orientation="horizontal"
            tools:ignore="UselessParent" >
        </LinearLayout>

        <Button
            style="@style/ButtonBarButton"
            android:layout_width="222dp"
            android:layout_height="62dp"
            android:layout_marginLeft="45dp"
            android:layout_marginTop="75dp"
            android:background="@color/black"
            android:paddingLeft="20dp"
            android:id="@+id/iolCalculation"
            android:text="@string/Button"
            android:textColor="@color/WhiteSmoke"
            android:textStyle="bold" />

        <Button
            style="@style/ButtonBarButton"
            android:layout_width="222dp"
            android:layout_height="62dp"
            android:layout_marginLeft="45dp"
            android:id="@+id/sHelp"
            android:layout_marginTop="139dp"
            android:background="@color/Black"
            android:gravity="center"
            android:paddingLeft="10dp"
            android:text="@string/Button1"
            android:textColor="@color/WhiteSmoke"
            android:textStyle="bold" />

        <Button
            style="@style/ButtonBarButton"
            android:layout_width="222dp"
            android:layout_height="62dp"
            android:id="@+id/sAbout"
            android:layout_marginLeft="45dp"
            android:layout_marginTop="203dp"
            android:background="@color/Black"
            android:paddingLeft="10dp"
            android:text="@string/Button2"
            android:textColor="@color/WhiteSmoke"
            android:textStyle="bold" >

        </Button>
</FrameLayout>

</FrameLayout>

看起来您忘记将意图过滤器标记添加到第二个活动。尝试以下清单更改

 <activity
        android:name=".Selection"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
        <intent-filter>
            <action android:name="my.example.myproject.SELECTION" />

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

看起来您忘记将意图过滤器标记添加到第二个活动。尝试以下清单更改

 <activity
        android:name=".Selection"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:label="@string/app_name"
        android:theme="@style/FullscreenTheme" >
        <intent-filter>
            <action android:name="my.example.myproject.SELECTION" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
写下面的代码

Intent mInSelection=new Intent(MainActivity.this,Selection.class);
startActivity(mInSelection);
而不是

Intent iolIntent=new Intent("my.example.myproject.SELECTION");
startActivity(iolIntent);
<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >

    <action android:name="my.example.myproject.SELECTION" />

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

</activity>
并将以下代码写入manifest.xml文件

<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
而不是

Intent iolIntent=new Intent("my.example.myproject.SELECTION");
startActivity(iolIntent);
<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >

    <action android:name="my.example.myproject.SELECTION" />

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

</activity>
它会解决你的问题。

写下下面的代码

Intent mInSelection=new Intent(MainActivity.this,Selection.class);
startActivity(mInSelection);
而不是

Intent iolIntent=new Intent("my.example.myproject.SELECTION");
startActivity(iolIntent);
<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >

    <action android:name="my.example.myproject.SELECTION" />

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

</activity>
并将以下代码写入manifest.xml文件

<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
而不是

Intent iolIntent=new Intent("my.example.myproject.SELECTION");
startActivity(iolIntent);
<activity
    android:name=".Selection"
    android:configChanges="orientation|keyboardHidden|screenSize"
    android:label="@string/app_name"
    android:theme="@style/FullscreenTheme" >

    <action android:name="my.example.myproject.SELECTION" />

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

</activity>

这会解决你的问题。

我知道我迟到了,但它可以帮助别人。 再加上这个

Intent mInSelection=new Intent(MainActivity.this,my.example.myproject.SELECTION.class);
startActivity(mInSelection);

这肯定会对你有帮助。

我知道我迟到了,但它可以帮助别人。 再加上这个

Intent mInSelection=new Intent(MainActivity.this,my.example.myproject.SELECTION.class);
startActivity(mInSelection);


这肯定会对你有所帮助。

这两项活动都在同一个包中。@SahilMahajanMj是的,一切都在同一个包中package@AhamBrahmaasmi:那么迪帕克的回答很可能解决您的问题。@Dipakkesharya用我的主xml文件更新了这个问题。请帮忙。从过去两天开始尝试。@AhamBrahmaasmi将调用意图代码写入处理程序并尝试。这两个活动是否在同一个包中?@SahilMahajanMj是的,所有内容都在同一个包中package@AhamBrahmaasmi:那么迪帕克的回答很可能解决您的问题。@Dipakkesharya用我的主xml文件更新了这个问题。请帮忙。从过去两天开始尝试。@AhamBrahmaasmi将调用意图代码写入处理程序并尝试。您是否在累积以上两个答案?没有问题。其中一个答案已被删除。但是,在发布新答案之前,请确保您查看了其他答案@AhamBrahmaasmi是的,为什么不?@DipakKeshariya用我的主xml文件更新了这个问题。请帮忙。从过去两天开始尝试。你是否在累积以上两个答案?没有问题。其中一个答案已被删除。但是,在发布新答案之前,请确保您查看了其他答案@AhamBrahmaasmi是的,为什么不?@DipakKeshariya用我的主xml文件更新了这个问题。请帮忙。从过去两天开始尝试。