0

我得到活动未找到异常。它与我一起使用 f9 具有相同的意图和表现。但是当我在联系活动代码中进行更改时,就会开始出现异常。
现在联系活动代码如下

public class Contact extends Activity {



   // @TargetApi(5)
    @Override
    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

            setContentView(R.layout.contactlist);



            Button btnSimple = (Button) findViewById(R.id.btnSimple);

            btnSimple.setOnClickListener(new OnClickListener() {



                public void onClick(View v) {



                    Toast.makeText(getApplicationContext(),

                            " You clicked Simple ListView button", Toast.LENGTH_SHORT).show();



                    Intent intent = new Intent(v.getContext(), Upload_Contacts.class);
            });
    }}
                    startActivityForResult(intent, 0);

                }

这是我的日志猫

12-03 03:42:12.128: D/AndroidRuntime(1130): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-03 03:42:12.128: D/AndroidRuntime(1130): CheckJNI is ON
12-03 03:42:12.728: D/AndroidRuntime(1130): Calling main entry com.android.commands.pm.Pm
12-03 03:42:12.758: D/AndroidRuntime(1130): Shutting down VM
12-03 03:42:12.778: D/dalvikvm(1130): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
12-03 03:42:12.778: D/dalvikvm(1130): Debugger has detached; object registry had 1 entries
12-03 03:42:12.788: I/AndroidRuntime(1130): NOTE: attach of thread 'Binder Thread #3' failed
12-03 03:42:13.318: D/AndroidRuntime(1140): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-03 03:42:13.318: D/AndroidRuntime(1140): CheckJNI is ON
12-03 03:42:14.019: D/AndroidRuntime(1140): Calling main entry com.android.commands.am.Am
12-03 03:42:14.058: I/ActivityManager(61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.fyp.smb/.Login } from pid 1140
12-03 03:42:14.098: D/AndroidRuntime(1140): Shutting down VM
12-03 03:42:14.108: D/dalvikvm(1140): GC_CONCURRENT freed 102K, 69% free 319K/1024K, external 0K/0K, paused 1ms+1ms
12-03 03:42:14.108: D/dalvikvm(1140): Debugger has detached; object registry had 1 entries
12-03 03:42:14.148: I/AndroidRuntime(1140): NOTE: attach of thread 'Binder Thread #3' failed
12-03 03:42:15.558: I/ActivityManager(61): Displayed com.fyp.smb/.Login: +1s484ms
12-03 03:42:17.248: I/ActivityManager(61): Starting: Intent { act=com.fyp.smb.MAIN cmp=com.fyp.smb/.Main } from pid 1121
12-03 03:42:19.408: I/ActivityManager(61): Displayed com.fyp.smb/.Main: +2s62ms
12-03 03:42:24.608: D/dalvikvm(127): GC_EXPLICIT freed 32K, 52% free 2886K/5895K, external 4738K/5293K, paused 148ms
12-03 03:42:40.268: I/ActivityManager(61): Starting: Intent { act=com.fyp.smb.CONTACTS cmp=com.fyp.smb/.Contact } from pid 1121
12-03 03:42:40.879: W/ActivityManager(61): Activity pause timeout for HistoryRecord{4078dc90 com.fyp.smb/.Main}
12-03 03:42:50.386: W/ActivityManager(61): Launch timeout has expired, giving up wake lock!
12-03 03:42:50.952: W/ActivityManager(61): Activity idle timeout for HistoryRecord{407eb998 com.fyp.smb/.Contact}

这是我的意图。

Intent contact = new Intent("com.fyp.smb.CONTACTS");
                startActivity(contact);

这是清单

<activity
            android:name=".Contact"
            android:label="@string/title_activity_login" >
            <intent-filter>
                <action android:name="com.fyp.smb.CONTACTS" />

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

为什么会发生错误,请提供任何解决方案

4

1 回答 1

0

不管你如何写意图?

Intent contact = new Intent(getApplicationContext(), Contact.class);
            this.startActivity(contact);
于 2012-12-02T23:31:34.553 回答