0

アクティビティが見つからないという例外が発生しています。それは私と同じ意図とマニフェストで機能していました。しかし、連絡先アクティビティコードを変更すると、例外が発生し始めます。
連絡先アクティビティ コードは次のとおりです。

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);

                }

ここに私のlogcatがあります

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 に答える