특정 앱을 주입하면 콘텐츠 제공 업체에 등록하라는 메시지가 해당 앱에 전송됩니다. 모두 잘 작동하지만 문자열은 저장되지만 broadcastreciever에서 onRecieve() 내에서 제대로 변환하려면 byte [] blob (비트 맵 .png 파일)을 가져올 수 없습니다. 내가)합니다 (getAppIcon에서 전화를 이미지에 보류를 얻을 수 있도록BroadcastReciever에서 ContentProvider로 비트 맵 저장
@Override
public void onReceive(Context context, Intent intent) {
Log.v("xxxxxxxxxxxxx", "onReceive, from within RegisterApp");
this.context = context;
ContentValues values = new ContentValues();
values.put("app_name", getAppName());
values.put("app_description", getAppDescription());
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Bitmap b = getAppIcon();
b.compress(Bitmap.CompressFormat.PNG, 0, stream);
byte[] blob = stream.toByteArray();
values.put("icon", blob);
context.getContentResolver().insert(
Uri.parse("content://blahblahblahblah"), values);
}
내가 문맥을 납치
즉
@Override
protected Bitmap getAppIcon() {
Log.v(TAG, "putting icon");
return BitmapFactory.decodeResource(this.context.getResources(), R.drawable.icon);
}
(당신은 브로드 캐스트 리시버를 확장하는 추상 클래스이 클래스를 확장)
하지만 컨텍스트에 대한 이해가 제한되어 있으며 이것이 잘못 저장되는 원인이라고 생각합니다.
또한 onRecieve()가 호출 될 때 리소스에서 비트 맵을 가져 오려고했는데 그 중 하나가 작동하지 않습니다.
나는 손실을 입었습니다. 도움을 주시면 감사하겠습니다.