Key android.intent.extra.INITIAL_INTENTS expected Parcelable[] but value was a android.content.Intent. The default value was returned
이메일 발송관련 기능을 개발하던 과정에 발생한 오류이다.
Intent 호출 전 설정하는 과정에 EXTRA_INITIAL_INTENTS를 사용하였다.
10-29 11:00:26.860 11294-11294/ddolcatmaster.finedustrecord W/Bundle: Key android.intent.extra.INITIAL_INTENTS expected Parcelable[] but value was a android.content.Intent. The default value <null> was returned.
10-29 11:00:26.870 11294-11294/ddolcatmaster.finedustrecord W/Bundle: Attempt to cast generated internal exception:
java.lang.ClassCastException: android.content.Intent cannot be cast to android.os.Parcelable[]
at android.os.Bundle.getParcelableArray(Bundle.java:832)
at android.content.Intent.getParcelableArrayExtra(Intent.java:5428)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:8186)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1492)
at android.app.Activity.startActivityForResult(Activity.java:3942)
at android.app.Activity.startActivityForResult(Activity.java:3889)
at android.app.Activity.startActivity(Activity.java:4213)
at android.app.Activity.startActivity(Activity.java:4181)
at ddolcatmaster.finedustrecord.MainActivity$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:5184)
at android.view.View$PerformClick.run(View.java:20910)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
10-29 11:00:26.900 11294-11317/ddolcatmaster.finedustrecord V/FA: Recording user engagement, ms: 30456
이메일 발송시 Intent.EXTRA_INITIAL_INTENTS는 intent가 여러개 일 경우에만 사용해야한다.
Intent chooserIntent = Intent.createChooser(emailIntent, getResources().getString(R.string.setting_30) );//"Choose an Email Client..."
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, emailIntent);
Intent.EXTRA_INITIAL_INTENTS를 제외하고 발송하면 정상 동작한다.
Intent chooserIntent = Intent.createChooser(emailIntent, getResources().getString(R.string.setting_30) );//"Choose an Email Client..."
startActivity(chooserIntent);