申请结束错误

时间:2014-11-28 11:48:33

标签: android eclipse emulation

当我尝试创建微调控件时,我收到以下错误。如果没有微调控件,一切都运行正常。

11-28 11:39:42.704: W/dalvikvm(937): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
11-28 11:39:42.744: E/AndroidRuntime(937): FATAL EXCEPTION: main
11-28 11:39:42.744: E/AndroidRuntime(937): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.atria.requisitionform/com.atria.requisitionform.RequisitionForm}; have you declared this activity in your AndroidManifest.xml?
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Activity.startActivityForResult(Activity.java:3370)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Activity.startActivityForResult(Activity.java:3331)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Activity.startActivity(Activity.java:3566)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.Activity.startActivity(Activity.java:3534)
11-28 11:39:42.744: E/AndroidRuntime(937):  at com.atria.requisitionform.MainActivity.onClick(MainActivity.java:27)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.view.View.performClick(View.java:4204)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.view.View$PerformClick.run(View.java:17355)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.os.Handler.handleCallback(Handler.java:725)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.os.Handler.dispatchMessage(Handler.java:92)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.os.Looper.loop(Looper.java:137)
11-28 11:39:42.744: E/AndroidRuntime(937):  at android.app.ActivityThread.main(ActivityThread.java:5041)
11-28 11:39:42.744: E/AndroidRuntime(937):  at java.lang.reflect.Method.invokeNative(Native Method)
11-28 11:39:42.744: E/AndroidRuntime(937):  at java.lang.reflect.Method.invoke(Method.java:511)
11-28 11:39:42.744: E/AndroidRuntime(937):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-28 11:39:42.744: E/AndroidRuntime(937):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-28 11:39:42.744: E/AndroidRuntime(937):  at dalvik.system.NativeStart.main(Native Method)
11-28 11:39:42.805: W/ActivityManager(295):   Force finishing activity com.atria.requisitionform/.MainActivity
11-28 11:39:42.834: W/WindowManager(295): Failure taking screenshot for (266x425) to layer 21010
11-28 11:39:43.134: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property
11-28 11:39:43.365: W/ActivityManager(295): Activity pause timeout for ActivityRecord{40ed0d08 u0 com.atria.requisitionform/.MainActivity}
11-28 11:39:43.755: I/ARMAssembler(36): generated scanline__00000077:03515104_00008001_00000000 [113 ipp] (134 ins) at [0x428a56c0:0x428a58d8] in 8299291 ns
11-28 11:39:43.814: I/Choreographer(418): Skipped 31 frames!  The application may be doing too much work on its main thread.
11-28 11:39:44.534: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property

微调控件的布局如下:

<Spinner
            android:id="@+id/ddlMaterials"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:entries="@array/materials"
            android:prompt="@string/materialList"
             />

“申请单”表单活动中的代码为:

ddlMaterials = (Spinner) findViewById(R.id.ddlMaterials);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
                this, R.array.materials, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        ddlMaterials.setAdapter(adapter);
        ddlMaterials.setOnItemSelectedListener(new MaterialSpinner());
        });

实现seOnItemSelected的类是:

package com.atria.requisitionform;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Toast;

public class MaterialSpinner implements OnItemSelectedListener {
    public void onItemSelected(AdapterView<?> parent, View view, int pos,
            long id) {
        Toast.makeText(
                parent.getContext(),
                "OnItemSelectedListener : "
                        + parent.getItemAtPosition(pos).toString(),
                Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub
    }
}

请尽快熟悉Android,因为我是Android新手。实际上这是我的第一个申请。

1 个答案:

答案 0 :(得分:0)

旋转器没有问题。 您尝试调用应用程序无法识别此活动名称的活动的问题是

RequisitionForm

确保在AndroidManifest.xml文件中正确声明此活动