0

カスタムビューからアクティビティを開始しているときに、android 4.2.2 でのみこの例外 (ActivityNotFound) が発生します。これは、4.1.1 以下のすべてのデバイスで正常に機能します。

4.2.2 で同様の問題に直面した人はいますか?

カスタム ビューからアクティビティを開始するコード

Intent intent = new Intent(getContext(), MyActivity.class);
intent.putExtra(Constants.EXTRAS1, serializable);
intent.putExtra(Constants.EXTRAS2, serializable);           
((Activity)getContext()).startActivityForResult(intent, Constants.MY_ACTION);

スタックトレース:

06-04 16:58:29.715: E/AndroidRuntime(20568): FATAL EXCEPTION: main
06-04 16:58:29.715: E/AndroidRuntime(20568): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.sample.activity/com.sample.activity.MyActivity}; have you declared this activity in your AndroidManifest.xml?
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1635)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1434)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.Activity.startActivityForResult(Activity.java:3430)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.Activity.startActivityForResult(Activity.java:3391)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.View.dispatchTouchEvent(View.java:7461)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2186)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1516)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.Activity.dispatchTouchEvent(Activity.java:2466)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2134)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.View.dispatchPointerEvent(View.java:7641)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3676)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3607)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4802)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4781)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4873)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.os.MessageQueue.nativePollOnce(Native Method)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.os.MessageQueue.next(MessageQueue.java:125)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.os.Looper.loop(Looper.java:124)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at android.app.ActivityThread.main(ActivityThread.java:5293)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at java.lang.reflect.Method.invokeNative(Native Method)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at java.lang.reflect.Method.invoke(Method.java:511)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
06-04 16:58:29.715: E/AndroidRuntime(20568):    at dalvik.system.NativeStart.main(Native Method)
4

1 に答える 1

0

問題はマニフェストにありました

このアクティビティをマニフェストで次のように宣言しました。

 <activity android:name="com.sample.MyActivity" android:theme="@android:style/Theme.Translucent"
         android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> 
         </activity>

以下のように、宣言からパッケージ参照を削除すると動作し始めました。

 <activity android:name=".MyActivity" android:theme="@android:style/Theme.Translucent"
             android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> 
             </activity>

パッケージ参照で宣言されたアプリに他のアクティビティがあり、それが正常に動作するため、このアクティビティに対してのみこのように動作する理由がわかりません。

于 2013-06-05T17:27:41.863 に答える