안녕하세요.
다름이 아니라 intent에 에러가 밑에와 같이 났습니다.
07-03 20:23:34.891: E/AndroidRuntime(31390): java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43b59658 (pid=31390) when getting content provider settings
07-03 20:23:33.566: W/Bundle(30511): Attempt to cast generated internal exception:
07-03 20:23:33.566: W/Bundle(30511): java.lang.ClassCastException: byte[] cannot be cast to android.os.Parcelable
07-03 20:23:34.891: E/AndroidRuntime(31390): java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43b59658 (pid=31390) when getting content provider settings
07-03 20:23:34.891: E/AndroidRuntime(31390): at android.os.Parcel.readException(Parcel.java:1431)
----------------------------
저의 소스는
private void share(String nameApp, String imagePath) {
List<Intent> targetedShareIntents = new ArrayList<Intent>();
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("application/pdf");
List<ResolveInfo> resInfo = getPackageManager().queryIntentActivities(share, 0);
if (!resInfo.isEmpty()){
for (ResolveInfo info : resInfo) {
Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND);
targetedShare.setType("application/pdf"); // put here your mime type
if (info.activityInfo.packageName.toLowerCase().contains(nameApp) || info.activityInfo.name.toLowerCase().contains(nameApp)) {
try {
targetedShare.putExtra(Intent.EXTRA_STREAM, pdfRead());
} catch (IOException e) {
e.printStackTrace();
}
targetedShare.setPackage(info.activityInfo.packageName);
targetedShareIntents.add(targetedShare);
}
}
Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "선택해주세요" );
//chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[]{}));
startActivity(chooserIntent);
}
}
pdf를 담은 객체가 byte[]로 담겨져 있는데요. 이걸 intent로 넘기려 하니깐 오류가 떴습니다.
byte[]로 담긴 용량이 커서 그런것 같기도 하고, 정확한 이유를 몰라 글을 남깁니다.
고수님들의 조언을 듣고 싶습니다.